Crusader_Decomp/docs/scummvm/run-scummvm.ps1

37 lines
1.1 KiB
PowerShell
Raw Normal View History

[CmdletBinding()]
param (
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Debug',
[string[]]$ScummVMArgs = @()
)
$ErrorActionPreference = 'Stop'
$sourceRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..\scummvm'))
$buildDirectory = Join-Path $sourceRoot 'build-msvc'
$executable = Join-Path $buildDirectory "$($Configuration)x64\scummvm.exe"
if (-not (Test-Path -LiteralPath $executable -PathType Leaf)) {
throw "'$executable' was not found. Run build-scummvm.ps1 -Configuration $Configuration first."
}
$previousPath = $env:PATH
try {
$vcpkgBin = Join-Path $buildDirectory 'vcpkg_installed\x64-windows'
if ($Configuration -eq 'Debug') {
$vcpkgBin = Join-Path $vcpkgBin 'debug\bin'
} else {
$vcpkgBin = Join-Path $vcpkgBin 'bin'
}
if (-not (Test-Path -LiteralPath $vcpkgBin -PathType Container)) {
throw "The vcpkg $Configuration DLL directory was not found at '$vcpkgBin'."
}
$env:PATH = "$vcpkgBin;$previousPath"
& $executable @ScummVMArgs
if ($LASTEXITCODE -ne 0) {
throw "ScummVM exited with code $LASTEXITCODE."
}
} finally {
$env:PATH = $previousPath
}