Invoke-FuzzyEdit - `Cmd.exe` UNC Handling
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
Still working on the commit. I got my branch up to date with master though.