Skip to content

Commit

Permalink
fix game folder detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldin101 committed Oct 15, 2024
1 parent 2115e3c commit 52adcef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions FindGamePath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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("\", "/")
}
Expand Down
4 changes: 4 additions & 0 deletions Main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52adcef

Please sign in to comment.