diff --git a/FindGamePath.ps1 b/FindGamePath.ps1 index eba812a..1e89071 100644 --- a/FindGamePath.ps1 +++ b/FindGamePath.ps1 @@ -24,10 +24,13 @@ function findGamePath { $joinedLine = [regex]::Replace($joinedLine, '\}(\s*\n\s*\")', '},$1', "Multiline") $joinedLine = [regex]::Replace($joinedLine, '\"\,(\n\s*\})', '"$1', "Multiline") $joinedLine = $joinedLine -replace ',(\s*[\]}])', '$1' - $libaryfolders = $joinedLine | ConvertFrom-Json + $libaryfolders = ($joinedLine | ConvertFrom-Json) - foreach ($folder in $libaryfolders) { - $gamePath = "$steamPath\steamapps\common\Get To The Orange Door\" + for ($i = 0; $true; $i++) { + $gamePath = "$($libaryfolders.libraryfolders.$i.path)\steamapps\common\Get To The Orange Door\" + if (!(Test-Path $gamePath)) { + break + } if (Test-Path $gamePath) { return $gamePath.Replace("\", "/") } diff --git a/Main.ps1 b/Main.ps1 index 5c3ccb4..6d70378 100644 --- a/Main.ps1 +++ b/Main.ps1 @@ -66,6 +66,10 @@ if (!(test-path "$env:appdata\GTTOD Mod Manager\config.json")) { } else { try { $global:config = Get-Content "$env:appdata\GTTOD Mod Manager\config.json" | ConvertFrom-Json + if (!(Test-Path $config.gamePath)) { + $config.gamePath = findGamePath + $config | ConvertTo-Json | Set-Content "$env:appdata\GTTOD Mod Manager\config.json" + } } catch { $global:config = @{ "glow" = $true