Skip to content

Commit 64ac797

Browse files
filtered out Unity Hub path and better version found
1 parent 531fdae commit 64ac797

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class UnitySetupInstance {
5050

5151
UnitySetupInstance([string]$path) {
5252
$currentOS = Get-OperatingSystem
53+
$foundVersion = $false
5354

5455
if ( Test-Path "$path\modules.json" ) {
5556
$modules = (Get-Content "$path\modules.json" -Raw) | ConvertFrom-Json
@@ -59,6 +60,7 @@ class UnitySetupInstance {
5960

6061
if ( $null -ne $match ) {
6162
$this.Version = [UnityVersion]$match
63+
$foundVersion = $true
6264
break
6365
}
6466
}
@@ -70,10 +72,11 @@ class UnitySetupInstance {
7072
if ( $null -ne $ivy ) {
7173
[xml]$xmlDoc = Get-Content $ivy.FullName
7274
$this.Version = [UnityVersion]$xmlDoc.'ivy-module'.info.unityVersion
75+
$foundVersion = $true
7376
}
7477
}
7578

76-
if ( $this.Version -ne $null ) {
79+
if ( $foundVersion -eq $false ) {
7780
throw "Failed to find a valid version identifier for installation at $path!";
7881
}
7982

@@ -1105,6 +1108,7 @@ function Get-UnitySetupInstance {
11051108
$setupInstances = [UnitySetupInstance[]]@()
11061109

11071110
foreach ( $path in $searchPaths ) {
1111+
if( $path -like '*Unity Hub*' ) { continue }
11081112
$setupInstances += , [UnitySetupInstance]::new($path)
11091113
}
11101114

0 commit comments

Comments
 (0)