File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,20 @@ class UnitySetupInstance {
52
52
$currentOS = Get-OperatingSystem
53
53
$foundVersion = $false
54
54
55
+ Write-Verbose " Attempting to get Unity Setup Instance at $path "
56
+
55
57
if ( Test-Path " $path \modules.json" ) {
58
+
56
59
$modules = (Get-Content " $path \modules.json" - Raw) | ConvertFrom-Json
57
60
58
61
foreach ( $module in $modules ) {
59
- $match = $module.DownloadUrl -match " (\d+)\.(\d+)\.(\d+)([fpab])(\d+)" | Out-Null
62
+ Write-Verbose " Found module $ ( $module.id ) "
63
+ Write-Verbose " Download Url $ ( $module.DownloadUrl ) "
60
64
61
- if ( $null -ne $ match ) {
62
- $this.Version = [UnityVersion ]$match
65
+ if ( $module .DownloadUrl - match " (\d+)\.(\d+)\.(\d+)([fpab])(\d+) " ) {
66
+ $this.Version = [UnityVersion ]$Matches [ 0 ]
63
67
$foundVersion = $true
68
+ Write-Verbose " Found $ ( $this.Version ) "
64
69
break
65
70
}
66
71
}
@@ -1108,8 +1113,9 @@ function Get-UnitySetupInstance {
1108
1113
$setupInstances = [UnitySetupInstance []]@ ()
1109
1114
1110
1115
foreach ( $path in $searchPaths ) {
1111
- if ( $path -like ' *Unity Hub*' ) { continue }
1112
- $setupInstances += , [UnitySetupInstance ]::new($path )
1116
+ if ( $path -match " (\d+)\.(\d+)\.(\d+)([fpab])(\d+)" ) {
1117
+ $setupInstances += , [UnitySetupInstance ]::new($path )
1118
+ }
1113
1119
}
1114
1120
1115
1121
return $setupInstances
You can’t perform that action at this time.
0 commit comments