Skip to content

Add app to local env and Path concat

Example with UE

ps1
# ... launch custonm version of ue, push in perforce
# Plugins args path is for pacakge implementation of rez package usage


$UEVersion="5.0.3"

# Get local workspace
$LocalWorkspace = (p4 -F %clientRoot% -ztag info) | out-string 
$LocalWorkspace = $LocalWorkspace -replace "`n|`r"

# Compute engine plugin path
$EnginePath = Join-Path $LocalWorkspace "Dev"
$EnginePath = Join-Path $EnginePath "UnrealEngine-$($UEVersion)"
$EnginePath = Join-Path $EnginePath "Engine"
$EnginePath = Join-Path $EnginePath "Binaries"
$EnginePath = Join-Path $EnginePath "Win64"

# Add to path
$env:Path += ";$($EnginePath)"


# If no plugin requested
if ($null -eq $env:UNREAL_PLUGIN_PATH) {
	Start-Process -FilePath UnrealEditor.exe
	return
}

# Get requested plugins by custom env (in rez package)
$PathAsArray = $env:UNREAL_PLUGIN_PATH.Split(";")
$FinalParameters = ""

# Concat all plugin args from UNREAL_PLUGIN_PATH
Foreach($p in $PathAsArray) 
{ 	
	$p = $p.replace('/', '\')
	$FinalParameters += "-PLUGIN=`"$p`" "
}

# Execute final command
Start-Process -FilePath UnrealEditor.exe -ArgumentList $FinalParameters