const VectorString& Ogre2DataManager::getDataListNames(const std::string& _pattern, bool _fullpath) { static VectorString result; result.clear(); VectorString search; if (mAllGroups) { Ogre::StringVector sp = Ogre::ResourceGroupManager::getSingleton().getResourceGroups(); search.reserve(sp.size()); for (size_t i = 0; i < sp.size(); i++) search.push_back(sp[i]); } else search.push_back(mGroup); std::vector<Ogre::FileInfoListPtr> pFileInfos; int resultSize = 0; for (size_t i = 0; i < search.size(); i++) { Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(search[i], _pattern); resultSize += pFileInfo->size(); if (!pFileInfo->empty()) pFileInfos.push_back(pFileInfo); else pFileInfo.setNull(); } result.reserve(resultSize); for (size_t i = 0; i < pFileInfos.size(); i++) { Ogre::FileInfoListPtr pFileInfo = pFileInfos[i]; for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi ) { if (fi->path.empty()) { bool found = false; for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter) { if (*iter == fi->filename) { found = true; break; } } if (!found) { result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename); } } } pFileInfo.setNull(); } return result; }
const VectorString& OgreDataManager::getDataListNames(const std::string& _pattern, bool _fullpath) { static VectorString result; result.clear(); Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, _pattern); result.reserve(pFileInfo->size()); for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi ) { if (fi->path.empty()) { bool found = false; for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter) { if (*iter == fi->filename) { found = true; break; } } if (!found) { result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename); } } } pFileInfo.setNull(); return result; }