|
Boost Users : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-02-10 21:20:07
"Paul Giaccone" <paulg_at_[hidden]> wrote in message
news:43EC8417.8010000_at_cinesite.co.uk...
> The following line in my Windows program:
>
> boost::filesystem::path my_path(my_filename,
> boost::filesystem::native);
>
> converts backslashes in my_filename to forward slashes, which means than
> when I use boost::filesystem::exists on the result, the file is reported
> as not existing even though it does.
>
> I notice the comments in boost::filesystem::m_path_append(), which is
> called by the constructor of boost::filesystem::path, say that this is
> what the function does, but this contradicts the documentation.
> http://boost.org/libs/filesystem/doc/portability_guide.htm says, of
> native:
>
> Side effect: Syntax for path constructor /src/ string is
> implementation defined according to the path syntax rules for the
> operating system.
>
> Use: In path constructors, when the source is operator input or
> other sources which are formatted according to operating system rules.
>
> I understand this to mean that boost::filesystem::native converts the
> file into the format required by the OS. I certainly would not expect
> it to make the format wrong if it is already correct.
>
> Is there something I've overlooked here, or is this a bug, or is the
> documentation wrong (or just misleading)? I'm puzzled.
I assume you are using 1.33.1 or earlier. It certainly handles both back and
forward slashes correctly for the mostpart, although I wouldn't be surprised
if there were obsure bugs in corner cases such as \\? pathnames.
Why don't you give the 1.34 version from the CVS HEAD a try. It uses a much
simplified (and hopefully improved) way of handling native formats. You no
longer have to do anything special such as using a special constructor
argument.
Good luck,
--Beman
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