Get-UE-Version can now determine version from source builds

This commit is contained in:
Steve Streeting 2023-09-28 14:35:09 +01:00
parent f8f519d48f
commit f3fab64c0c

View File

@ -52,10 +52,20 @@ function Get-UE-Version {
)
if ($uproject.EngineAssociation) {
return $uproject.EngineAssociation
$assoc = $uproject.EngineAssociation
} else {
# Plugin
return $uproject.EngineVersion
$assoc = $uproject.EngineVersion
}
# If this is a GUID "{A1234786-..}" then it's a source build, we need to resolve it via registry
if ($assoc.StartsWith("{")) {
# Look up the source dir from registry setting
$srcdir = Get-ItemPropertyValue 'Registry::HKEY_CURRENT_USER\Software\Epic Games\Unreal Engine\Builds' -Name $assoc
# In source build, read Build.version JSON
$buildverfile = Join-Path $srcdir "Engine/Build/Build.version"
$buildjson = (Get-Content $buildverfile) | ConvertFrom-Json
return "$($buildjson.MajorVersion).$($buildjson.MinorVersion)"
}
}