diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b99d34..2291008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - PowerShell: use global scope for aliases. - Zsh: fix errors with `set -eu`. - Fzf: handle early selection. +- PowerShell: correctly handle escape characters in paths. ## [0.7.9] - 2021-11-02 diff --git a/templates/powershell.txt b/templates/powershell.txt index 110504e..fd02b80 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -7,17 +7,19 @@ # pwd based on zoxide's format. function __zoxide_pwd { - $__zoxide_pwd = Get-Location - if ($__zoxide_pwd.Provider.Name -eq "FileSystem") { - $__zoxide_pwd.ProviderPath + $cwd = Get-Location + if ($cwd.Provider.Name -eq "FileSystem") { + $cwd.ProviderPath } } # cd + custom logic based on the value of _ZO_ECHO. function __zoxide_cd($dir) { - Set-Location $dir -ea Stop {%- if echo %} - $(Get-Location).Path + $dir = Set-Location -LiteralPath $dir -Passthru -ErrorAction Stop + Write-Output $dir.Path +{%- else %} + Set-Location -LiteralPath $dir -ErrorAction Stop {%- endif %} }