Skip to content

Commit aa70e5e

Browse files
authored
Merge pull request #206 from jwittner/fix/passingNullPathToSusi
More robust Path testing in Select-UnitySetupInstance
2 parents 4983dab + b3040ed commit aa70e5e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,11 +1296,17 @@ function Select-UnitySetupInstance {
12961296
[UnitySetupInstance[]] $Instances
12971297
)
12981298

1299+
begin {
1300+
if ( $Path ) {
1301+
$pathInfo = Resolve-Path $Path -ErrorAction Ignore
1302+
}
1303+
}
1304+
12991305
process {
1300-
if ( $PSBoundParameters.ContainsKey('Path') ) {
1301-
$Path = $Path.TrimEnd([io.path]::DirectorySeparatorChar)
1306+
if ( $pathInfo ) {
13021307
$Instances = $Instances | Where-Object {
1303-
$Path -eq (Get-Item $_.Path).FullName.TrimEnd([io.path]::DirectorySeparatorChar)
1308+
$instancePathInfo = Resolve-Path $_.Path -ErrorAction Ignore
1309+
return $pathInfo.Path -eq $instancePathInfo.Path
13041310
}
13051311
}
13061312

0 commit comments

Comments
 (0)