Boost logo

Boost :

From: me22 (me22.ca_at_[hidden])
Date: 2007-06-12 01:20:34


On 11/06/07, Michael Marcin <mmarcin_at_[hidden]> wrote:
> Something like the following would work for me.
>
> is_file_within_directory_tree( "C:\export", "C:\work\anotherfile.txt" ); //
> returns false
> is_file_within_directory_tree( "C:\export", "C:\export\blah\myfile.txt" );
> // returns true
>
> Is there an easy way to do this with Boost.Filesystem?
>
Depending what you want, you could do a find for the leaf of the file
over a recursive_directory_iterator of the path, or you could see if
the iterator range in the path is a prefix of that in the file.

~ Scott McMurray


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk