Skip to content

Commit e7ffdb4

Browse files
PR feedback
1 parent 183b28f commit e7ffdb4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class UnitySetupInstance {
4949
[string]$Path
5050

5151
UnitySetupInstance([string]$path) {
52-
$version = $null
5352
$currentOS = Get-OperatingSystem
5453

5554
if ( Test-Path "$path\modules.json" ) {
@@ -59,7 +58,7 @@ class UnitySetupInstance {
5958
$module.DownloadUrl -match "(\d+)\.(\d+)\.(\d+)([fpb])(\d+)" | Out-Null
6059

6160
if ( $Matches -ne $null ) {
62-
$version = [UnityVersion]$Matches[0]
61+
$this.Version = [UnityVersion]$Matches[0]
6362
break
6463
}
6564
}
@@ -68,18 +67,17 @@ class UnitySetupInstance {
6867
# We'll attempt to search for the version using the ivy.xml definitions for legacy editor compatibility.
6968
$ivy = Get-ChildItem -Path $path -Filter ivy.xml -Recurse -ErrorAction SilentlyContinue -Force | Select-Object -First 1
7069

71-
if ( Test-Path $ivy.FullName ) {
70+
if ( $null -ne $ivy ) {
7271
[xml]$xmlDoc = Get-Content $ivy.FullName
73-
$version = [UnityVersion]$xmlDoc.'ivy-module'.info.unityVersion
72+
$this.Version = [UnityVersion]$xmlDoc.'ivy-module'.info.unityVersion
7473
}
7574
}
7675

7776
if ( $version -eq $null ) {
78-
throw "Failed to find a valid installation at $path!";
77+
throw "Failed to find a valid version identifier for installation at $path!";
7978
}
8079

8180
$this.Path = $path
82-
$this.Version = $version
8381

8482
$playbackEnginePath = $null
8583
$componentTests = switch ($currentOS) {
@@ -1104,7 +1102,7 @@ function Get-UnitySetupInstance {
11041102
}
11051103

11061104
$searchPaths = Get-ChildItem $BasePath | Get-ChildItem | ForEach-Object { $_.Directory.FullName }
1107-
$searchPaths = $searchPaths | select -uniq
1105+
$searchPaths = $searchPaths | Select-Object -uniq
11081106
$setupInstances = [UnitySetupInstance[]]@()
11091107

11101108
foreach ( $path in $searchPaths ) {

0 commit comments

Comments
 (0)