File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1245,16 +1245,20 @@ function Get-UnitySetupInstanceVersion {
1245
1245
1246
1246
# Try to look in the modules.json file for installer paths that contain version info
1247
1247
if ( Test-Path " $path \modules.json" - PathType Leaf ) {
1248
+ try {
1249
+ Write-Verbose " Searching $path \modules.json for module versions"
1250
+ $table = (Get-Content " $path \modules.json" - Raw) | ConvertFrom-Json - AsHashtable
1248
1251
1249
- Write-Verbose " Searching $path \modules.json for module versions"
1250
- $modules = (Get-Content " $path \modules.json" - Raw) | ConvertFrom-Json
1251
-
1252
- foreach ( $module in $modules ) {
1253
- Write-Verbose " `t Testing DownloadUrl $ ( $module.DownloadUrl ) "
1254
- if ( $module.DownloadUrl -notmatch " (\d+)\.(\d+)\.(\d+)([fpab])(\d+)" ) { continue ; }
1252
+ foreach ( $url in $table.downloadUrl ) {
1253
+ Write-Debug " `t Testing DownloadUrl $url "
1254
+ if ( $url -notmatch " (\d+)\.(\d+)\.(\d+)([fpab])(\d+)" ) { continue ; }
1255
1255
1256
- Write-Verbose " `t Found version!"
1257
- return [UnityVersion ]$Matches [0 ]
1256
+ Write-Verbose " `t Found version!"
1257
+ return [UnityVersion ]$Matches [0 ]
1258
+ }
1259
+ }
1260
+ catch {
1261
+ Write-Verbose " Error parsing $path \modules.json:`n`t $_ "
1258
1262
}
1259
1263
}
1260
1264
You can’t perform that action at this time.
0 commit comments