Add a fallback to installation script
Fallback to searching the steam executable if not found in registry
This commit is contained in:
parent
ea9b5b173f
commit
1e4e164a5e
1 changed files with 29 additions and 0 deletions
|
@ -13,6 +13,8 @@ function Get-RegistryValue {
|
|||
}
|
||||
}
|
||||
|
||||
Write-Host "Searching for Steam installation..."
|
||||
|
||||
# Get Steam installation path from registry
|
||||
$steam_dir = Get-RegistryValue "HKLM:\SOFTWARE\Valve\Steam" "InstallPath"
|
||||
|
||||
|
@ -20,12 +22,39 @@ if (-not $steam_dir) {
|
|||
$steam_dir = Get-RegistryValue "HKLM:\SOFTWARE\WOW6432Node\Valve\Steam" "InstallPath"
|
||||
}
|
||||
|
||||
# Fallback to searching for Steam.exe on C: drive
|
||||
if (-not $steam_dir) {
|
||||
Write-Host "No registry key found. Searching for Steam executable on C: drive..."
|
||||
$steam_exe = Get-ChildItem -Path 'C:\' -Recurse -Include "Steam.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
|
||||
if ($steam_exe) {
|
||||
$steam_dir = Split-Path $steam_exe.FullName -Parent
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback to searching for Steam.exe on drives from D: onwards
|
||||
if (-not $steam_dir) {
|
||||
Write-Host "No registry key found. Searching for Steam executable on all drives..."
|
||||
$drives = Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Name -gt 'C' }
|
||||
|
||||
foreach ($drive in $drives) {
|
||||
$steam_exe = Get-ChildItem -Path "$($drive.Name):\" -Recurse -Include "Steam.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
|
||||
if ($steam_exe) {
|
||||
$steam_dir = Split-Path $steam_exe.FullName -Parent
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $steam_dir) {
|
||||
Write-Host "Steam installation path not found"
|
||||
Read-Host "Press Enter to exit"
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "Steam installation path: $steam_dir"
|
||||
|
||||
# Check for Garry's Mod installation
|
||||
$gmod_dir = Join-Path $steam_dir "steamapps\common\GarrysMod"
|
||||
if (-not (Test-Path (Join-Path $steam_dir "steamapps\appmanifest_4000.acf"))) {
|
||||
|
|
Loading…
Reference in a new issue