Description
UNC Path handling for Invoke-FuzzyEdit doesn't work as expected. Additionally, I'd like to optimize the logic a bit within the function?
Reproduce
cd "\\servername\C$\Program Files"
Invoke-FuzzyEdit
## OR
Invoke-FuzzyEdit '\\servername\C$\Users\'
Expected
I expect to open fzf within the current UNC path at the $PWD or within the -Directory passed in.
Actual
I received the below message and fzf opens in the $HOME directory on a non-elevated session.
'\\servername\c$'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
Solution
Wrap calls to Cmd.exe in current shell to pushd outside of current directory in case the $PWD is set at a UNC path. Secondly, within the Cmd.exe call, add a "DOS" pushd for the applicable UNC path. Additionally, for the optimizations, I'd like to remove the two cds when -Directory is used and the += array setting.
Environment
Module Version: 2.3.2
Windows Powershell: 5.1.18362.1171
PowerShell Core: 7.2.1
WSL2 Ubuntu: 20.04.3 LTS
Description
UNC Path handling for
Invoke-FuzzyEditdoesn't work as expected. Additionally, I'd like to optimize the logic a bit within the function?Reproduce
Expected
I expect to open
fzfwithin the current UNC path at the$PWDor within the-Directorypassed in.Actual
I received the below message and
fzfopens in the$HOMEdirectory on a non-elevated session.Solution
Wrap calls to
Cmd.exein current shell topushdoutside of current directory in case the$PWDis set at a UNC path. Secondly, within theCmd.execall, add a "DOS"pushdfor the applicable UNC path. Additionally, for the optimizations, I'd like to remove the twocds when-Directoryis used and the+=array setting.Environment
Module Version:
2.3.2Windows Powershell:
5.1.18362.1171PowerShell Core:
7.2.1WSL2 Ubuntu:
20.04.3 LTS