|
Boost Users : |
Subject: Re: [Boost-users] boost::filesystem::native
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-11-10 17:51:44
On 11/11/2016 09:05, Christopher J. Pisz wrote:
> Great! I say to myself.
> I then Google up the boost doc here:
> http://www.boost.org/doc/libs/1_62_0/libs/filesystem/doc/portability_guide.htm
[...]
> Boost says the following path is not valid for the native operating
> system: D:\Programing Projects\Git Workspace\Common\x64\Debug
> Boost says the following path is not valid for the native operating
> system: D:Programing Projects\Git Workspace\Common\x64\Debug\
> Boost says the following path is not valid for the native operating
> system: D:/Programing Projects/Git Workspace/Common/x64/Debug
> Boost says the following path is not valid for the native operating
> system: D:/Programing Projects/Git Workspace/Common/x64/Debug/
>
> What is wrong with that path that it says it is not valid for my native
> Windows 10 operating system?
After looking at the implementation and reading the docs more carefully:
Your assumptions were wrong. :)
It turns out that the portability functions (native() and friends) do
not check *paths* for validity, they check *path components* (eg.
individual filenames).
In particular the path separator characters are considered invalid.
This is why "\PATH" is considered valid, because this is treated as
"PATH", while "\\PATH" is not valid because the backslash is invalid in
a filename.
So if you wanted to use those, you'd need to wrap it in a path() first
and iterate over each element to test if it is valid.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net