#include "FileSystemUtil.h" #ifdef _WIN32 #include #include #include #include #include #include void _FindFileRev(const std::string& dirname, const int skiplevel,const int maxlevel,int nowlevel, const std::function& func) { std::string patternString=dirname+"*"; WIN32_FIND_DATA fnd; HANDLE hand=FindFirstFile(patternString.c_str(),&fnd); if(hand!=INVALID_HANDLE_VALUE) { do { std::string fullname=dirname+fnd.cFileName; if(fnd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if(maxlevel>0 && nowlevelskiplevel) func(fullname); } } while(FindNextFile(hand,&fnd)); FindClose(hand); } } void FindFileRev(const std::string& dirname, const int skiplevel,const int maxlevel, const std::function& func) { if(dirname[dirname.size()-1]!='\\') { std::string dirnamex=dirname+"\\"; _FindFileRev(dirnamex,skiplevel,maxlevel,1,func); } else { _FindFileRev(dirname,skiplevel,maxlevel,1,func); } } #endif // _WIN32