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::filesystem_error;
22 using boost::filesystem::exists;
23 using boost::filesystem::is_directory;
25 using boost::tokenizer;
26 using boost::char_separator;
33 typedef tokenizer<char_separator<char>> Tokenizer;
35 Tokenizer tok( stringifiedPath, char_separator<char>( separator ) );
39 auto it = tok.begin();
40 while ( it != tok.end() ) {
44 }
catch ( boost::filesystem::filesystem_error& ) {
54 bool dirExist( existsDir( dir ) );
57 if ( m_dirs.end() ==
std::find_if( m_dirs.begin(), m_dirs.end(),
eqPath( dir ) ) ) m_dirs.push_back( dir );
67 if ( ( rc =
find(
path( fileName ), fileFound ) ) ) fullFileName = fileFound.
string();
77 for (
const auto& iDir : m_dirs ) {
78 path full{iDir / file};
79 if ( exists( full ) ) {
92 for (
const auto& iDir : m_dirs ) {
93 path full{iDir / file};
94 if ( exists( full ) ) found.
push_back( full );
104 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