Get-ModifiablePath - Added test to exclude ParentPath of \ from candidates
as c:\ is always modifiable and not relevant. This only comes up with parameters being misread as paths.
This commit is contained in:
parent
c7985c9bc3
commit
bc7be3bdff
|
|
@ -853,7 +853,7 @@ function Get-ModifiablePath {
|
|||
# if the path doesn't exist, check if the parent folder allows for modification
|
||||
try {
|
||||
$ParentPath = Split-Path $TempPath -Parent
|
||||
if($ParentPath -and (Test-Path -Path $ParentPath)) {
|
||||
if ($ParentPath -and ($ParentPath -ne '') -and ($ParentPath -ne '\') -and (Test-Path -Path $ParentPath )) {
|
||||
$CandidatePaths += Resolve-Path -Path $ParentPath -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path
|
||||
}
|
||||
}
|
||||
|
|
@ -880,7 +880,7 @@ function Get-ModifiablePath {
|
|||
# if the path doesn't exist, check if the parent folder allows for modification
|
||||
try {
|
||||
$ParentPath = (Split-Path -Path $TempPath -Parent).Trim()
|
||||
if($ParentPath -and ($ParentPath -ne '') -and (Test-Path -Path $ParentPath )) {
|
||||
if ($ParentPath -and ($ParentPath -ne '') -and ($ParentPath -ne '\') -and (Test-Path -Path $ParentPath )) {
|
||||
$CandidatePaths += Resolve-Path -Path $ParentPath | Select-Object -ExpandProperty Path
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue