From c9b893b051b5f66cbedbd86aa5241a84af5321aa Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 5 Oct 2020 13:26:09 +0100 Subject: [PATCH] Read uproject and determine UE version --- inc/ueinstall.ps1 | 7 +++++++ inc/uproject.ps1 | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 inc/ueinstall.ps1 diff --git a/inc/ueinstall.ps1 b/inc/ueinstall.ps1 new file mode 100644 index 0000000..adc1825 --- /dev/null +++ b/inc/ueinstall.ps1 @@ -0,0 +1,7 @@ +function Get-UE-Install { + param ( + [string]$ueVersion + ) + + return "TODO" +} diff --git a/inc/uproject.ps1 b/inc/uproject.ps1 index 6e2293e..2b1d239 100644 --- a/inc/uproject.ps1 +++ b/inc/uproject.ps1 @@ -1,5 +1,6 @@ . $PSScriptRoot\packageconfig.ps1 + function Get-Uproject-Filename { param ( [string]$srcfolder, @@ -28,3 +29,23 @@ function Get-Uproject-Filename { return Resolve-Path $projfile } +# Read the uproject file and return as a PSCustomObject +# Haven't defined this as a custom class because we don't control it +function Read-Uproject { + param ( + [string]$uprojectfile + ) + + # uproject is just JSON + return (Get-Content $uprojectfile) | ConvertFrom-Json + +} + +function Get-UE-Version { + param ( + # the uproject object from Read-Uproject + [psobject]$uproject + ) + + return $uproject.EngineAssociation +} \ No newline at end of file