Skip to content

Commit cfd1721

Browse files
updated Get-UnitySetupInstance to use the same modules.json and ivy.xml recursive search pattern
1 parent 342a15a commit cfd1721

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,6 @@ function Get-UnitySetupInstance {
10921092
if (-not $BasePath) {
10931093
$BasePath = @('C:\Program Files*\Unity*', 'C:\Program Files\Unity\Hub\Editor\*')
10941094
}
1095-
$ivyPath = 'Editor\Data\UnityExtensions\Unity\Networking\ivy.xml'
10961095
}
10971096
([OperatingSystem]::Linux) {
10981097
throw "Get-UnitySetupInstance has not been implemented on the Linux platform. Contributions welcomed!";
@@ -1101,12 +1100,21 @@ function Get-UnitySetupInstance {
11011100
if (-not $BasePath) {
11021101
$BasePath = @('/Applications/Unity*', '/Applications/Unity/Hub/Editor/*')
11031102
}
1104-
$ivyPath = 'Unity.app/Contents/UnityExtensions/Unity/Networking/ivy.xml'
11051103
}
11061104
}
11071105

11081106
foreach ( $folder in $BasePath ) {
1109-
$path = [io.path]::Combine("$folder", $ivyPath);
1107+
1108+
if ( Test-Path "$folder\modules.json" ) {
1109+
$path = $folder
1110+
}
1111+
else {
1112+
$ivy = Get-ChildItem -Path $folder -Filter ivy.xml -Recurse -ErrorAction SilentlyContinue -Force | Select-Object -First 1
1113+
1114+
if ( Test-Path $ivy.FullName ) {
1115+
$path = $ivy.FullName
1116+
}
1117+
}
11101118

11111119
Get-ChildItem $path -Recurse -ErrorAction Ignore |
11121120
ForEach-Object {

0 commit comments

Comments
 (0)