Open Rufflewind opened 7 years ago
What if you do the Windows style path on a Mingw shell - does it expand before or after dereferencing?
Tried it in the MSYS shell (that one that comes with Stack):
C:\sym\link\..\foo
expands before deref.C:/sym/link/../foo
expands before deref./c/sym/link/../foo
expands after deref.That's disturbingly inconsistent... I guess you need two separate methods, one which expands ..
and one which doesn't.
@Rufflewind is this observed behavior or is there something in windows documentation suggesting this is behavior that can be relied upon?
I have not seen documentation around it but I haven't really tried looking per se. It's just a quirk I observed when trying to test native symbolic links on Windows.
Windows seems to interpret paths differently than on POSIX systems.
/sym/link/../foo
refers to/target/dir/../foo ≡ /target/foo
(..
expands after dereferencing).C:\sym\link\..\foo
always refers toC:\sym\foo
(..
expands before dereferencing).This feature would be useful to have because if you want to pass in extended-length paths (the
\\?\
prefix) you have to normalize the path before adding the prefix, otherwise the Windows API will interpret..
literally.