mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
30 lines
887 B
PowerShell
30 lines
887 B
PowerShell
function Find-DefaultTarget {
|
|
param (
|
|
[string]$srcfolder,
|
|
# Game, Editor, Server, Client
|
|
[string]$preferred = "Editor"
|
|
)
|
|
|
|
$sourcefolder = Join-Path (Resolve-Path $srcfolder) "Source"
|
|
|
|
# Enumerate the Target.cs files in Source folder and use the default one
|
|
# This lets us not assume what the modules are called exactly
|
|
$targetFiles = Get-ChildItem "$sourcefolder\*.Target.cs"
|
|
|
|
foreach ($file in $targetfiles) {
|
|
if ($file.Name -like "*$preferred.Target.cs") {
|
|
return $file.Name.SubString(0, $file.Name.Length - 10)
|
|
}
|
|
}
|
|
|
|
# Fall back on Game if nothing else
|
|
foreach ($file in $targetfiles) {
|
|
if ($file.Name -like "*Game.Target.cs") {
|
|
return $file.Name.SubString(0, $file.Name.Length - 10)
|
|
}
|
|
}
|
|
|
|
throw "Unable to find default build target ending in $preferred"
|
|
|
|
}
|