Boost logo

Boost Users :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2006-02-10 07:16:23


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.

Paul


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