Hi Guys
This bit of code...
#include <iostream>
#include
int main( )
{
const char * bits[] = { "first", "second", "third", "fourth", 0 };
boost::filesystem::path path;
for ( const char * * bit = bits; * bit; ++ bit )
{
path /= * bit;
}
while ( path.has_parent_path( ) )
{
std::cout << path << std::endl;
path.remove_filename( );
}
}
produces
first/second/third/fourth
first/second/third/
first/second/third
first/second/
first/second
first/
which surprised me, as the documentation says
basic_path& remove_filename();
*Effects:* If has_parent_path() then remove the last *filename* from the
stored path. If that leaves the stored path with one or more trailing *slash
* elements not representing *root-directory*, remove them.
Seems to me that remove_filename() does NOT remove trailing slashes as
stated.
- Rob.