51 dir = opendir ( path );
52 if ( dir == NULL ) { std::cerr <<
"!!! ProSHADE ERROR !!! Cannot open directory " << path << std::endl;
return false; }
54 while ( ( entry = readdir ( dir ) ) )
57 if ( entry->d_name[0] ==
'.' ) { ; }
60 if ( entry->d_type == DT_DIR )
63 std::string newPath = std::string ( path ) + std::string ( entry->d_name ) + systemDirectorySeparator;
64 if ( !
findFiles ( saveFiles, newPath.c_str(), ext ) )
66 std::cerr <<
"Directory recursion error!" << std::endl;
73 std::string fileName = std::string ( entry->d_name );
74 std::string extension = fileName.substr ( fileName.length() - std::string(ext).length(), fileName.length() - 1);
75 if ( std::strcmp ( extension.c_str(), std::string ( ext ).c_str() ) == 0 )
78 saveFiles->push_back ( std::string ( path ) + std::string ( entry->d_name ) );
bool findFiles(std::vector< std::string > *saveFiles, const char *path, const char *ext)
Function to recursively search for files with given extension in the file path supplied.
This header file contains function and globals required for platform-independent file detection...