From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-06-11 21:44:48


Suppose the following directory:

C:\export

As a command line argument in one of my applications, I get an absolute path
to a file. I want to check if this file exists at some nested level inside
of C:\export. Suppose the file passed in is:

C:\export\blah\myfile.txt

I would like to be able to call some sort of function that returns 'true' if
the file (myfile.txt) exists within the directory tree rooted at C:\export.

Now suppose this next file:

C:\work\anotherfile.txt

The function in question would return 'false' here since anotherfile.txt
does not exist inside of c:\export.

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?

Thanks,

Michael Marcin