Join-String dependency fix + Get-Path cleanup
If Join-String is missing, the 'string' module, if not existing will be installed and then imported. Get-Path produced an error when used with wildcard, fixed it with string substituation. Get-Path would output wildcard string when expansion didn't match, now output will be blank.
This commit is contained in:
parent
4da3726760
commit
b5b5702b17
2 changed files with 15 additions and 1 deletions
|
@ -27,17 +27,19 @@ process {
|
|||
}
|
||||
}
|
||||
|
||||
$p = $p -replace '#C-','#C-#' -replace '\*','#C-A#' -replace '\?','#C-Q#'
|
||||
if([System.IO.Path]::IsPathRooted($p)){
|
||||
$p = [System.IO.Path]::GetFullPath($p)
|
||||
}else{
|
||||
$p = [System.IO.Path]::GetFullPath((Join-Path $PWD $p))
|
||||
}
|
||||
$p = $p -replace '#C-A#','*' -replace '#C-Q#','?' -replace '#C-#','#C-'
|
||||
|
||||
if( $Expand ) {
|
||||
$p = $p | ForEach-Object {
|
||||
if( Test-Path $p ) {
|
||||
$p | Get-Item -Force | Select-Object -ExpandProperty FullName
|
||||
} else {
|
||||
} elseif( -not $Expand ) {
|
||||
$p
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue