bool FileFinder::Find(DirectorySpecifier &dir, Typecode type, bool recursive) { // Get list of entries in directory vector<dir_entry> entries; if (!dir.ReadDirectory(entries)) { return false; } sort(entries.begin(), entries.end()); // Iterate through entries vector<dir_entry>::const_iterator i, end = entries.end(); for (i = entries.begin(); i != end; i++) { // Construct full specifier of file/dir FileSpecifier file = dir + i->name; // DJB Skip our texture directories if ( dir.GetPathString().find ( "SpriteTextures" ) != string::npos || dir.GetPathString().find ( "TTEP" ) != string::npos ) { // Don't go down these paths return false; } if (i->is_directory) { // Recurse into directory if (recursive) { if (Find(file, type, recursive)) { return true; } } } else { // Check file type and call found() function if (type == WILDCARD_TYPE || type == file.GetType()) { if (found(file)) { return true; } } } } return false; }