u32 max=filelist->getFileCount();
(u32 i=0; i<max; i++)
{
cout<<filelist->getFileName(i).c_str()<<endl;
}
irr::video::ITexture * TextureManager::findInPath(irr::io::path path,irr::io::path filename){
irr::video::ITexture * t = NULL;
irr::io::path dir(path);
dir.append("*");
WIN32_FIND_DATA file;
HANDLE search_handle=FindFirstFile(LPCTSTR(dir.c_str()),&file);
if (search_handle)
{
do
{
irr::io::path resultPath;
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
//Skip any reference to current or parent folder. Else inf-loop imminent
if(file.cFileName[0] == '.'){
continue;
}
t = findInPath(path+file.cFileName + "/",filename);
if(t) return t;
}
else
{
irr::io::path sfile(file.cFileName);
std::cout << sfile.c_str();
if(sfile.equals_ignore_case(filename) == true)
{
resultPath = path + filename;
t = driver->getTexture(resultPath);
return t;
}
}
}while(FindNextFile(search_handle,&file));
FindClose(search_handle);
}
return t;
};irr::video::ITexture * TextureManager::findInPath(irr::io::path path,irr::io::path filename){
irr::video::ITexture * t = NULL;
irr::io::path dir(path);
dir.append("*");
irr::io::path currDir(path);
currDir.append(filename.c_str());
WIN32_FIND_DATA file;
HANDLE search_handle=FindFirstFile(LPCTSTR(dir.c_str()),&file);
irr::io::path resultPath;
if(GetFileAttributes(LPCTSTR(currDir.c_str())) != 0xFFFFFFFF)
{
resultPath = path + filename;
t = driver->getTexture(resultPath);
return t;
}
else if (searchRecursively == true && search_handle)
{
do
{
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
//Skip any reference to current or parent folder. Else inf-loop imminent
if(file.cFileName[0] == '.')
{
continue;
}
t = findInPath(path+file.cFileName + "/",filename);
if(t) return t;
}
}while(FindNextFile(search_handle,&file));
FindClose(search_handle);
}
return t;
};Users browsing this forum: No registered users and 1 guest