2021-02-18 15:53:32 +00:00
|
|
|
[CmdletBinding()]param(
|
|
|
|
[Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName,Position=0)]
|
|
|
|
[Alias("FullName")]
|
|
|
|
[string[]]$Path
|
|
|
|
)
|
|
|
|
process {
|
2020-11-05 04:31:34 +00:00
|
|
|
|
2021-02-18 15:53:32 +00:00
|
|
|
function Get-FullPath {
|
|
|
|
param([string]$Path)
|
2021-01-29 23:26:39 +00:00
|
|
|
|
2021-02-18 15:53:32 +00:00
|
|
|
if([System.IO.Path]::IsPathRooted($Path)){
|
|
|
|
[System.IO.Path]::GetFullPath($Path)
|
|
|
|
}else{
|
|
|
|
[System.IO.Path]::GetFullPath((Join-Path $PWD $Path))
|
|
|
|
}
|
2020-12-02 04:31:42 +00:00
|
|
|
}
|
2021-01-29 23:26:39 +00:00
|
|
|
|
2021-02-18 15:53:32 +00:00
|
|
|
foreach( $local:p in $Path ) {
|
|
|
|
switch( $p[0] ) {
|
|
|
|
'@' { $p = Join-Path $MyPSScriptRoot $p.Substring(1) }
|
|
|
|
'~' {
|
|
|
|
if( $p -match '^~[^/]*' ) {
|
|
|
|
$local:m = $Matches[0]
|
|
|
|
$p = $p -replace "^$m",((Get-Item $m).FullName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-29 23:26:39 +00:00
|
|
|
|
2021-02-18 15:53:32 +00:00
|
|
|
if([System.IO.Path]::IsPathRooted($p)){
|
|
|
|
[System.IO.Path]::GetFullPath($p)
|
|
|
|
}else{
|
|
|
|
[System.IO.Path]::GetFullPath((Join-Path $PWD $p))
|
|
|
|
}
|
|
|
|
}
|
2021-01-29 23:26:39 +00:00
|
|
|
}
|
|
|
|
# try {
|
|
|
|
# get-item $Path -Force -ErrorAction Stop |
|
|
|
|
# Select-Object -ExpandProperty FullName
|
|
|
|
# } catch {
|
|
|
|
# $_.targetObject
|
|
|
|
# }
|