Skip to content

Commit 183b28f

Browse files
Filter out just the needed paths to get the setup instances
1 parent cfd1721 commit 183b28f

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,24 +1103,15 @@ function Get-UnitySetupInstance {
11031103
}
11041104
}
11051105

1106-
foreach ( $folder in $BasePath ) {
1106+
$searchPaths = Get-ChildItem $BasePath | Get-ChildItem | ForEach-Object { $_.Directory.FullName }
1107+
$searchPaths = $searchPaths | select -uniq
1108+
$setupInstances = [UnitySetupInstance[]]@()
11071109

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-
}
1118-
1119-
Get-ChildItem $path -Recurse -ErrorAction Ignore |
1120-
ForEach-Object {
1121-
[UnitySetupInstance]::new((Join-Path $_.Directory "..\..\..\..\..\" | Convert-Path))
1122-
}
1110+
foreach ( $path in $searchPaths ) {
1111+
$setupInstances += , [UnitySetupInstance]::new($path)
11231112
}
1113+
1114+
return $setupInstances
11241115
}
11251116

11261117
<#

0 commit comments

Comments
 (0)