fix: stabilize godot 4.7 headless validation
This commit is contained in:
+35
-2
@@ -9,6 +9,8 @@ Set-Location $ROOT
|
||||
|
||||
$LOG = "logs/quality/latest"
|
||||
New-Item -ItemType Directory -Path $LOG -Force | Out-Null
|
||||
$GODOT_PROFILE = Join-Path $ROOT "logs/quality/godot_profile"
|
||||
New-Item -ItemType Directory -Path $GODOT_PROFILE -Force | Out-Null
|
||||
|
||||
$OVERALL = $false
|
||||
$ERRORS = @()
|
||||
@@ -16,8 +18,30 @@ $FIXES = @()
|
||||
$OWNED_GDSCRIPT_ROOTS = @("player", "simulation", "tests", "tools", "world")
|
||||
|
||||
# -- tool detection -----------------------------------------------------------
|
||||
function ConvertTo-ConsoleGodotPath($Path) {
|
||||
if (-not $Path) { return $null }
|
||||
$normalized = $Path.Replace('/', '\').Trim('"')
|
||||
if ($normalized.EndsWith(".exe")) {
|
||||
$consolePath = $normalized -replace '\.exe$', '_console.exe'
|
||||
if (Test-Path $consolePath) { return $consolePath }
|
||||
}
|
||||
if (Test-Path $normalized) { return $normalized }
|
||||
return $null
|
||||
}
|
||||
|
||||
function Find-ProjectGodot {
|
||||
$metadata = Join-Path $ROOT ".godot/editor/project_metadata.cfg"
|
||||
if (-not (Test-Path $metadata)) { return $null }
|
||||
$line = Select-String -Path $metadata -Pattern '^executable_path=' | Select-Object -First 1
|
||||
if (-not $line) { return $null }
|
||||
$rawPath = ($line.Line -replace '^executable_path=', '').Trim().Trim('"')
|
||||
return ConvertTo-ConsoleGodotPath $rawPath
|
||||
}
|
||||
|
||||
function Find-Godot {
|
||||
if ($env:GODOT_BIN) { return $env:GODOT_BIN }
|
||||
if ($env:GODOT_BIN) { return (ConvertTo-ConsoleGodotPath $env:GODOT_BIN) }
|
||||
$projectGodot = Find-ProjectGodot
|
||||
if ($projectGodot) { return $projectGodot }
|
||||
try { return (Get-Command godot -ErrorAction Stop).Source } catch {}
|
||||
try { return (Get-Command godot4 -ErrorAction Stop).Source } catch {}
|
||||
$common = @(
|
||||
@@ -99,7 +123,16 @@ function Invoke-GodotWithTimeout {
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.CreateNoWindow = $true
|
||||
$p = [Diagnostics.Process]::Start($psi)
|
||||
$previousAppData = $env:APPDATA
|
||||
$previousLocalAppData = $env:LOCALAPPDATA
|
||||
$env:APPDATA = $GODOT_PROFILE
|
||||
$env:LOCALAPPDATA = $GODOT_PROFILE
|
||||
try {
|
||||
$p = [Diagnostics.Process]::Start($psi)
|
||||
} finally {
|
||||
$env:APPDATA = $previousAppData
|
||||
$env:LOCALAPPDATA = $previousLocalAppData
|
||||
}
|
||||
$outputTask = $p.StandardOutput.ReadToEndAsync()
|
||||
$errorTask = $p.StandardError.ReadToEndAsync()
|
||||
$exited = $p.WaitForExit(30000)
|
||||
|
||||
Reference in New Issue
Block a user