-
Notifications
You must be signed in to change notification settings - Fork 190
Description
Windows case-sensitivity for drive letters is not always interpreted correctly.
To Reproduce:
fs::path path = fs::relative("c:\\dev\\working\\directory\\file.txt");
Assuming the current working directory is C:\dev\working\directory
, one would expect path
to be file.txt
. However, because the second (optional) argument to relative
is evaluated as C:\dev\working\directory
(capital 'C'), lexically_relative
will exit early on its first check and simply return a default-constructed path
.
A fix for this specific issue could be to force drive letters to be capital, say, in weakly_canonical
. Now, even Windows can't guarantee case-insensitivity for all file names, but I do believe that drive letters are case-insensitive -- for example, I don't think you can have a d:
and D:
drive mounted simultaneously. Additionally, under MSVC, it appears that path equality checks are completely case-insensitive when using the standard template library's file system implementation. This does not seem to be the case when compiling under any other compiler.