Skip to content

Commit b3040ed

Browse files
committed
More robust Path testing
1 parent 4983dab commit b3040ed

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)