cirnogodot/TestGodotPath.ps1

111 lines
4.3 KiB
PowerShell
Raw Permalink Normal View History

2026-02-07 22:31:11 +01:00
# Test script to verify Godot PATH resolution
# Run this to test if godot.exe can be found
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host " Godot PATH Resolution Test" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
# Test 1: Check if godot.exe is in PATH
Write-Host "Test 1: Checking if godot.exe is in PATH..." -ForegroundColor Cyan
$godotCmd = Get-Command godot.exe -ErrorAction SilentlyContinue
if ($godotCmd) {
Write-Host " ✓ Found: $($godotCmd.Source)" -ForegroundColor Green
$godotInPath = $godotCmd.Source
} else {
Write-Host " ✗ Not found in PATH" -ForegroundColor Red
$godotInPath = $null
}
Write-Host ""
# Test 2: Check GODOT environment variable
Write-Host "Test 2: Checking GODOT environment variable..." -ForegroundColor Cyan
if ($env:GODOT) {
Write-Host " ✓ GODOT = $env:GODOT" -ForegroundColor Green
if (Test-Path $env:GODOT) {
Write-Host " ✓ File exists" -ForegroundColor Green
} else {
Write-Host " ✗ File does not exist at that path" -ForegroundColor Red
}
} else {
Write-Host " ⚠ GODOT environment variable not set" -ForegroundColor Yellow
}
Write-Host ""
# Test 3: Import module and test resolution
Write-Host "Test 3: Testing module resolution..." -ForegroundColor Cyan
try {
$modulePath = Join-Path $PSScriptRoot "CirnoBuild.psm1"
Import-Module $modulePath -Force
if ($env:GODOT) {
$testPath = $env:GODOT
} elseif ($godotInPath) {
$testPath = "godot.exe"
} else {
Write-Host " ⚠ Cannot test - no Godot found" -ForegroundColor Yellow
Write-Host ""
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host " Result: Godot not available" -ForegroundColor Red
Write-Host "=====================================" -ForegroundColor Cyan
exit 1
}
Write-Host " Testing with: $testPath" -ForegroundColor Gray
$result = Test-Prerequisites -GodotPath $testPath -SkipButler
if ($result.Valid) {
Write-Host " ✓ Prerequisites check passed" -ForegroundColor Green
if ($result.ResolvedGodotPath) {
Write-Host " ✓ Resolved to: $($result.ResolvedGodotPath)" -ForegroundColor Green
}
} else {
Write-Host " ✗ Prerequisites check failed" -ForegroundColor Red
}
} catch {
Write-Host " ✗ Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
# Test 4: Verify Godot version
Write-Host "Test 4: Checking Godot version..." -ForegroundColor Cyan
if ($godotInPath) {
try {
$version = & $godotInPath --version 2>&1 | Select-Object -First 1
Write-Host " ✓ Version: $version" -ForegroundColor Green
} catch {
Write-Host " ✗ Could not get version" -ForegroundColor Red
}
} elseif ($env:GODOT -and (Test-Path $env:GODOT)) {
try {
$version = & $env:GODOT --version 2>&1 | Select-Object -First 1
Write-Host " ✓ Version: $version" -ForegroundColor Green
} catch {
Write-Host " ✗ Could not get version" -ForegroundColor Red
}
} else {
Write-Host " ⚠ Skipped - no Godot path available" -ForegroundColor Yellow
}
Write-Host ""
# Summary
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host " Summary" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
if ($godotInPath -or ($env:GODOT -and (Test-Path $env:GODOT))) {
Write-Host "✓ Godot is available and should work with build scripts" -ForegroundColor Green
Write-Host ""
Write-Host "You can now run:" -ForegroundColor Cyan
Write-Host " .\BuildPublish.bat" -ForegroundColor White
Write-Host " .\BuildPublish.ps1" -ForegroundColor White
Write-Host " .\Export.ps1" -ForegroundColor White
} else {
Write-Host "✗ Godot is not properly configured" -ForegroundColor Red
Write-Host ""
Write-Host "To fix, do one of the following:" -ForegroundColor Yellow
Write-Host " 1. Add godot.exe to your PATH" -ForegroundColor White
Write-Host " 2. Set GODOT environment variable to full path" -ForegroundColor White
Write-Host " Example: `$env:GODOT = 'C:\Path\To\godot.exe'" -ForegroundColor Gray
}
Write-Host ""