5 # pragma warning( disable : 4996 ) 13 # pragma warning( disable : 279 ) 16 #include "boost/filesystem/operations.hpp" 17 #include "boost/tokenizer.hpp" 21 using boost::filesystem::exists;
22 using boost::filesystem::filesystem_error;
23 using boost::filesystem::is_directory;
25 using boost::char_separator;
26 using boost::tokenizer;
32 typedef tokenizer<char_separator<char>> Tokenizer;
34 Tokenizer tok( stringifiedPath, char_separator<char>( separator ) );
38 auto it = tok.begin();
39 while ( it != tok.end() ) {
43 }
catch ( boost::filesystem::filesystem_error& ) {}
51 bool dirExist( existsDir( dir ) );
54 if ( m_dirs.end() ==
std::find_if( m_dirs.begin(), m_dirs.end(),
eqPath( dir ) ) ) m_dirs.push_back( dir );
63 if ( ( rc =
find(
path( fileName ), fileFound ) ) ) fullFileName = fileFound.
string();
71 for (
const auto& iDir : m_dirs ) {
72 path full{iDir / file};
73 if ( exists( full ) ) {
85 for (
const auto& iDir : m_dirs ) {
86 path full{iDir / file};
87 if ( exists( full ) ) found.
push_back( full );
96 rc = is_directory(
path( dirName ) );
boost::filesystem::path path
bool add(const path &dir)
bool find(const std::string &fileName, std::string &fullFileName) const
returns a flag if fileName found in search path, and sets ref to fully qualified file name (in native...
std::list< path > find_all(const path &file) const
returns lists of files found in search path.
bool addCWD()
add current work dir (*nix pwd) to path
search for files in a list of directories
static bool existsDir(const std::string &dirName)
check dirName is valid