Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-09-22 12:05:17

At 10:05 PM 9/21/2003, Tim Nowaczyk wrote:

>Is there a limitation on leading dots on directory names in
>boost::filesystem::path? The following code aborts on my debian machine
>with libboost-dev 1.30.0-4
>---- Code ----
>#include <iostream>
>#include <boost/filesystem/path.hpp>
>int main ()
> boost::filesystem::path p ("/tmp/.temp/1.txt");
> std::cout << p.string () << std::endl;
> std::cout << p.leaf () << std::endl;
> std::cout << p.branch_path ().string () << std::endl;
> boost::filesystem::path q ("/tmp/..temp/1.txt");
> std::cout << q.string () << std::endl;
> std::cout << q.leaf () << std::endl;
> std::cout << q.branch_path ().string () << std::endl;

In the 1.30.0 release, there was a limitation and it was hard-wired.

In the current CVS, the name checking mechanism has had a major update. The
default name check function is portable_name(), and it prohibits leading
and trailing periods and hyphens. But you can override that with either one
of the other name check functions provided or a user provided function. You
can override the default itself like this:

   boost::filesystem::portable_posix_name );

or you can override for a particular constructor like this:

boost::filesystem::path p ("/tmp/.temp/1.txt",

One of the provided functions, no_check, always returns true so in effect
turns off checking entirely.



Boost list run by bdawes at, gregod at, cpdaniel at, john at