Boost logo

Boost Users :

From: Jason Stewart (jstewart_at_[hidden])
Date: 2005-07-15 08:05:57

At 01:46 AM 7/15/2005, you wrote:
>Victor A. Wagner Jr. wrote:
> > '/' works just fine in Windows, always has except from a command shell
> > if it's an error in boost, then there is an error in boost
>I am using Boost.filesystem for my filemanager and I also noticed that
>it's extremely harsh with naming conventions for paths.

Drive letters (i.e. "c:") and backslashes in particular will cause it to
throw an exception if you don't use the 'native' flag.

I used this simple test program:

     path p1("/this/is/a/test");
     cout << p1.string() << endl;

     path p2("\\this\\is\\a\\test", native);
     cout << p2.string() << endl;

Notice that the native flag is required for the second path. The separators
are translated to forward slashes internally by the library so the output
of the above two paths is the same.

>(Then again however the native keyword looks rather useless, because
>there *is* no syntax which works for all platforms and so you are forced
>to use native).

I believe that it uses forward slashes internally and converts to native
format when asked (at least on Win32).

I also understand (but could be mistaken) that the next version (with I18N
support) does away with the native checks.


>Matthias Kaeppler
>Boost-users mailing list

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at