Boost logo

Boost Users :

From: Alo Sarv (alo.sarv_at_[hidden])
Date: 2005-07-17 17:14:20


When passing "foo\bar" to boost::filesystem::path constructor, it is
accepted when compiled with MSVC, but is refused when compiled with
mingw-gcc (v3.4.2). "foo/bar" argument is accepted with both
compilers.

Test-case:

#include <boost/filesystem/path.hpp>
#include <iostream>
using namespace boost::filesystem;
using namespace std;

int main(int argc, char *argv[])
{
        path::default_name_check(native);
        try {
                path p1("foo/bar");
                cerr << "ok - constructed from 'foo/bar'" << endl;
        } catch (std::exception &e) {
                cerr << e.what() << endl;
        }
        try {
                path p1("foo\\bar");
                cerr << "ok - constructed from 'foo\\bar'" << endl;
        } catch (std::exception &e) {
                cerr << e.what() << endl;
        }
        return 0;
}

Compiled with:
g++ -I c:\boostcvs\include\boost-1_33 -L c:\boostcvs\lib test-path.cpp
-o test-path -lboost_filesystem-mgw-d
Tested against: Boost 1.32 release, CVS HEAD

Is it a bug in FS library, or I'm doing something wrong? One would
expect native paths be accepted by path with native namechecker, and I
can't see any mingw/msvc-specific code in FS library, which could
explain why it works with one compiler, but not with other compiler...

Alo


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