Unable to parse relative directories in Windows UNC paths?


I’m having an odd issue with parsing constructed paths that involve Windows UNC prefixes. As far as I can tell, Rust is refusing to follow relative paths embedded inside any path with a Windows UNC prefix.

For example, these files exist:

But this claims not to exist:

I’m only noticing this because I tried to read in a path, call fs::canonicalize() (which adds the UNC prefix), then join on another path that contains a relative offset.

Am I missing something subtle about how paths are handled?


Rust has nothing to do with it. From this MSDN page on Naming Files, Paths, and Namespaces:

For file I/O, the “\\?” prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. […] Because it turns off automatic expansion of the path string, the “\\?” prefix also allows the use of “…” and “.” in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path.