Expose productName in UnityProjectInstance

This commit is contained in:
Tim Gerken 2019-03-29 17:13:37 +00:00
Родитель fa131b7a17
Коммит 05d2f6bbb2
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -122,6 +122,7 @@ class UnitySetupInstance {
class UnityProjectInstance {
[UnityVersion]$Version
[string]$Path
[string]$ProductName
UnityProjectInstance([string]$path) {
$versionFile = [io.path]::Combine($path, "ProjectSettings\ProjectVersion.txt")
@ -130,8 +131,15 @@ class UnityProjectInstance {
$fileVersion = (Get-Content $versionFile -Raw | ConvertFrom-Yaml)['m_EditorVersion'];
if (!$fileVersion) { throw "Project is missing a version in: $versionFile"}
$projectSettingsFile = [io.path]::Combine($path, "ProjectSettings\ProjectSettings.asset")
if (!(Test-Path $projectSettingsFile)) { throw "Project is missing ProjectSettings.asset"}
$prodName = ((Get-Content $projectSettingsFile -Raw | ConvertFrom-Yaml)['playerSettings'])['productName']
if (!$prodName) { throw "ProjectSettings is missing productName"}
$this.Path = $path
$this.Version = $fileVersion
$this.ProductName = $prodName
}
}