Skip to content

Commit 6ba5f79

Browse files
committed
Support for Mac for Get-UnitySetupInstance.
1 parent 43386b8 commit 6ba5f79

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,26 @@ function Get-UnitySetupInstance {
471471
[CmdletBinding()]
472472
param(
473473
[parameter(Mandatory = $false)]
474-
[string[]] $BasePath = @('C:\Program Files*\Unity*', 'C:\Program Files\Unity\Hub\Editor\*')
474+
[string[]] $BasePath
475475
)
476476

477+
# Windows
478+
if ((-not $PSVersionTable.Platform) -or ($PSVersionTable.Platform -eq "Win32NT")) {
479+
if (-not $BasePath) {
480+
$BasePath = @('C:\Program Files*\Unity*', 'C:\Program Files\Unity\Hub\Editor\*')
481+
}
482+
$ivyPath = 'Editor\Data\UnityExtensions\Unity\Networking\ivy.xml'
483+
}
484+
# Mac or Linux
485+
else {
486+
if (-not $BasePath) {
487+
$BasePath = @('/Applications/Unity*')
488+
}
489+
$ivyPath = 'Unity.app/Contents/UnityExtensions/Unity/Networking/ivy.xml'
490+
}
491+
477492
foreach ( $folder in $BasePath ) {
478-
$path = [io.path]::Combine("$folder", 'Editor\Data\UnityExtensions\Unity\Networking\ivy.xml');
493+
$path = [io.path]::Combine("$folder", $ivyPath);
479494

480495
Get-ChildItem $path -Recurse -ErrorAction Ignore |
481496
ForEach-Object {

0 commit comments

Comments
 (0)