zoxide icon indicating copy to clipboard operation
zoxide copied to clipboard

Support UNC Paths on windows

Open davidkna opened this issue 4 years ago • 6 comments

Currently zoxide outputs an when navigating to UNC paths like SMB shares \\NAS\Share or WSL files \\wsl$\fedoraremix:

zoxide: invalid path: UNC(
    "wsl$",
    "fedoraremix",
) \\wsl$\fedoraremix

davidkna avatar Mar 24 '21 17:03 davidkna

The problem here seems to be that \\NAS\Share resolves to \\?\UNC\NAS\Share, which PowerShell refuses to cd into. The UNC path is technically valid - for example, Python would have no problem with running os.chdir(r"\\?\UNC\NAS\Share").

I think the best solution here would be writing a custom path resolver for Windows that treats \\?\UNC\ as equivalent to \\, and converts it accordingly.

ajeetdsouza avatar Mar 25 '21 18:03 ajeetdsouza

This should be resolved in the dunce crate, I've filed an issue here: https://gitlab.com/kornelski/dunce/-/issues/2

ajeetdsouza avatar May 17 '21 21:05 ajeetdsouza

Just run into this issue trying to access WSL via Nushell. Works fine using PowerShell. It's been over a year since this issue and the other one over at dunce has been updated.

Nushell has an open issue regarding UNC paths and dunce: https://github.com/nushell/nushell/issues/4863#issuecomment-1071037345. Looks like they are related issues.

charlesroper avatar Aug 13 '22 14:08 charlesroper

Hm, looks like we need to move away from dunce if development has stalled. I'll look into this once I have the time.

ajeetdsouza avatar Aug 13 '22 15:08 ajeetdsouza

Dunce author just closed the issue with no fix. Guessing it has indeed stalled.

charlesroper avatar Sep 12 '22 00:09 charlesroper

The omnipath crate provides a fix for this problem: https://github.com/ChrisDenton/omnipath

See this related pull request: https://github.com/nushell/nushell/pull/6824

charlesroper avatar Oct 23 '22 23:10 charlesroper