Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Filename.dirname on Win32 UNC paths #7912
# let s = "\\\\foo" in Filename.(dirname s, basename s);; - : string * string = ("\\", "foo") # let s = "\\\\foo" in Filename.(concat (dirname s) (basename s));; - : string = "\\foo"
Note that the initial double backslash has been transformed to a single-one, such changing the original path (an absolute one) to a path relative to the current drive. The doc claims that :
Technically, \foo is not a valid file name, but it is a valid path.
Filename.dirname has some special logic under Win32 to extract the "drive" component. Shouldn't something similar be done for such UNC server component, which are also "roots"?
Comment author: @dbuenzli
I guess you already know that Windows paths are hairy. Here's a good reference about them:
which I ported from the Fpath library should determine the start of a windows path using