Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize drive letters when resolving paths on Windows #609

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mataha
Copy link
Contributor

@mataha mataha commented Aug 16, 2023

When it comes to resolving paths on Windows, even though the underlying API expects drive letter prefixes to be uppercase, some sources (e.g. environment variables like =C:) won't normalize components, instead returning the value as-is. While this wouldn't be a problem normally as NTFS is case-insensitive on Windows, this introduces duplicates in the database when adding new entries via zoxide add:

> zoxide query --list
D:\
d:\
D:\coding
d:\coding
D:\coding\.cloned
d:\coding\.cloned

This is a cherry-pick from #567; see also rust-lang/rust-analyzer#14683.

When it comes to resolving paths on Windows, even though the underlying
API expects drive letter prefixes to be uppercase, some sources (e.g.
environment variables like `=C:`) won't normalize components, instead
returning the value as-is. While this wouldn't be a problem normally as
NTFS is case-insensitive on Windows, this introduces duplicates in the
database when adding new entries via `zoxide add`:

```batchfile prompt
> zoxide query --list
D:\
d:\
D:\coding
d:\coding
D:\coding\.cloned
d:\coding\.cloned
```

This is a cherry-pick from ajeetdsouza#567; see also rust-lang/rust-analyzer#14683.

Signed-off-by: mataha <[email protected]>
@mataha mataha force-pushed the fix/drive-letter-normalization branch from 8a19d52 to ee5ba87 Compare June 15, 2024 12:07
mataha added a commit to mataha/zoxide that referenced this pull request Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant