static void handleSingleFile(const String &fileName, FileNameHandler &nameHandler) { DirList list = scandir(fileName,SELECTALLBUTDOT,SORTDIRLASTALPHA); for(size_t i = 0; i < list.size(); i++) { DirListEntry &e = list[i]; nameHandler.handleFileName(fileName.cstr(),e); } }
static void traverseDir(const String &path, FileNameHandler &nameHandler, WildCardRegex *filter, bool recurse) { DirList list = scandir(FileNameSplitter::getChildName(path,_T("*.*")),SELECTALLBUTDOT,SORTDIRLASTALPHA); nameHandler.handleStartDir(path.cstr()); for(size_t i = 0; i < list.size(); i++) { DirListEntry &e = list[i]; if(e.attrib & _A_SUBDIR) { if(recurse) { traverseDir(FileNameSplitter::getChildName(path,e.name), nameHandler, filter, recurse); } } else { if(filter && !filter->match(e.name)) { continue; } nameHandler.handleFileName(FileNameSplitter::getChildName(path,e.name).cstr(),e); } } nameHandler.handleEndDir(path.cstr()); }