Fix issues with PowerShell env variables
This commit is contained in:
parent
7113ccddea
commit
b7a884fbe0
|
|
@ -27,6 +27,7 @@ function global:__zoxide_pwd {
|
||||||
|
|
||||||
# cd + custom logic based on the value of _ZO_ECHO.
|
# cd + custom logic based on the value of _ZO_ECHO.
|
||||||
function global:__zoxide_cd($dir, $literal) {
|
function global:__zoxide_cd($dir, $literal) {
|
||||||
|
$dir = [System.Environment]::ExpandEnvironmentVariables($dir)
|
||||||
$dir = if ($literal) {
|
$dir = if ($literal) {
|
||||||
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -106,8 +107,8 @@ function global:__zoxide_z {
|
||||||
elseif ($args.Length -eq 1 -and ($args[0] -eq '-' -or $args[0] -eq '+')) {
|
elseif ($args.Length -eq 1 -and ($args[0] -eq '-' -or $args[0] -eq '+')) {
|
||||||
__zoxide_cd $args[0] $false
|
__zoxide_cd $args[0] $false
|
||||||
}
|
}
|
||||||
elseif ($args.Length -eq 1 -and (Test-Path $args[0] -PathType Container)) {
|
elseif ($args.Length -eq 1 -and (Test-Path ([System.Environment]::ExpandEnvironmentVariables($args[0])) -PathType Container)) {
|
||||||
__zoxide_cd $args[0] $true
|
__zoxide_cd ([System.Environment]::ExpandEnvironmentVariables($args[0])) $true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue