Repository navigation
Expand file tree
/
Copy pathrun.ps1
More file actions
44 lines (43 loc) · 1.7 KB
/
Copy pathrun.ps1
File metadata and controls
44 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
param(
[switch]$Editor,
[switch]$Benchmark,
[switch]$Export,
[switch]$ForwardPlus,
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$GameArgs
)
$ErrorActionPreference = 'Stop'
$engine = $env:GODOT_BIN
if (-not $engine) {
$installed = Get-Command godot, godot4 -ErrorAction SilentlyContinue | Select-Object -First 1
if ($installed) { $engine = $installed.Source }
}
if (-not $engine) {
$cached = Join-Path $env:USERPROFILE '.cache\gridfall-godot'
if (Test-Path -LiteralPath $cached) {
$engine = Get-ChildItem -LiteralPath $cached -Filter 'Godot*_win64.exe' |
Sort-Object Name -Descending | Select-Object -First 1 -ExpandProperty FullName
}
}
if (-not $engine -or -not (Test-Path -LiteralPath $engine)) {
throw 'Godot 4.4 or newer is required. Install Godot, add it to PATH, or set GODOT_BIN to its executable.'
}
if ($Export -or $Benchmark) {
$consoleEngine = Join-Path ([IO.Path]::GetDirectoryName($engine)) ([IO.Path]::GetFileNameWithoutExtension($engine) + '_console.exe')
if (Test-Path -LiteralPath $consoleEngine) { $engine = $consoleEngine }
}
$launchArgs = @('--path', $PSScriptRoot)
if ($ForwardPlus) { $launchArgs += @('--rendering-method', 'forward_plus') }
if ($Export) {
$buildDir = Join-Path $PSScriptRoot 'build'
New-Item -ItemType Directory -Force -Path $buildDir | Out-Null
$launchArgs += @('--headless', '--export-release', 'Windows Desktop', (Join-Path $buildDir 'GridFall.exe'))
}
if ($Editor) { $launchArgs += '--editor' }
if ($Benchmark) { $launchArgs += @('--', '--benchmark') }
if ($GameArgs) {
if (-not $Benchmark) { $launchArgs += '--' }
$launchArgs += $GameArgs
}
& $engine @launchArgs
exit $LASTEXITCODE