-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
. unhelpfully normalized to "C:" when current directory is "C:\" #5
Comments
For what it is worth, the equivalent in python and node do not attempt to transform . at all:
|
Thank you for reporting this! Strangely, WinAPI returns
Unfortunately, those functions are deceptively named. They are meant to simplify paths, rather than normalizing them, and can return incorrect results. For example, on Unix, they transform This crate asks the operating system for the normalized path, so it should be able to handle strange paths correctly. |
Thanks! Browsing the source, it looked to me like the heavy lifting was done by GetFullPathNameW, although that appeared to be doing the expected thing, so I wasn't really sure what was going on:
|
That's the right function, and thank you for the example. It clearly demonstrates that this is a bug in
Thus, allocating a larger buffer should be enough to easily resolve this issue, but I'll check if that causes any other issues. |
Version 0.3.2 should fix this issue. Thank you for the detailed bug report and comments! |
I am not a rust dev, just a user of the fd utility and this relates to a bug I found sharkdp/fd#931
It seems that when the current directory is "C:\" the normalize function of this library will transform "." into "C:".
With the following test app:
we get:
I think it would be much better if it returned C:\ instead, with the trailing separator. On windows, C: does not represent any specific directory, rather it represents the current directory associated with the C drive. It is a common misconception that C: is the same as C:\ but this is not the case.
The text was updated successfully, but these errors were encountered: