-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Relative paths on Windows: when to resolve . and .. ? #4659
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
Comments
It seems to be broken still or again on
where
|
@BarabasGitHub this was never addressed; it is separate from #4605. Status quo is that you must resolve |
@squeek502 Oh jeez. Who could have thought that the 'simple' thing of opening a file can be so complicated? And looking at it I don't even understand how it works. Am I supposed to pass the relative path to Sorry, I'm really confused and somewhere I believe it shouldn't be this hard to open a file with a relative path (which is the default you get on the command line in windows (powershell). It autocompletes to something like |
Seems like @andrewrk intends on allowing
This is just how |
Yes and it's weird and confusing if you ask me. The code in question looks like it's opening a file from the current working directory, but actually it has nothing whatsoever to do with the current working directory.
That's good. It should 'just work'. On the other hand... I can't find anything about how the C library handles it. It seems to be implementation defined. So it's clearly not an easy issue. |
This might be resolved with #7664. Could confirm by adding a test case that exercises the full |
These tests check that . and .. are able to be handled by the std.fs functions. Before ziglang#7664, these tests would have failed on Windows. Closes ziglang#4659
Related to #4605, #4655, #4658
From IRC (talking about #4655):
In the following test code:
If
test.zig
exists, the first open succeeds, but the second fails, even though they would resolve to the same path. This is because the file path is never resolved and when.\test.zig
is passed as theObjectName
toNtCreateFile
, it errors withSTATUS_OBJECT_NAME_INVALID
. The same thing happens if a path with..
is given as theObjectName
.It's unclear where this resolution should happen, exactly, and the current
fs
docs don't specify which types of paths each function accepts.The text was updated successfully, but these errors were encountered: