I have a big problem with StringVectorPtr. I am trying to make a archive plugin for a particular file format. It is like OgreZip class with some modifications for my necessity.
The plugin compile without errors but when I run a program that uses this plugin it stops in the function ResourceGroupManager::addResourceLocation, after the line 307 without
generating any error. It Simply stops.
This "error" happens when the Ogre try to get the iterator from data returned
by my MyArchive::find function.
Code: Select all
StringVectorPtr MyArchive::find(const String& pattern, bool recursive) {
FileList::iterator fileIterator;
String fileName;
String filePath;
String filePathName;
StringVectorPtr retVec = StringVectorPtr(new StringVector());
for (fileIterator=fileList.begin();fileIterator!=fileList.end();fileIterator++) {
filePath = (*fileIterator)->FileFullPathName;
fileName = (*fileIterator)->FileName;
filePathName = filePath + fileName;
if (recursive || filePath.empty()) {
if (StringUtil::match(fileName, pattern, false))
retVec->push_back(filePathName);
}
else {
if (StringUtil::match(filePathName, pattern, false))
retVec->push_back(filePathName);
};
};
return retVec;
}
.... ogre code
void ResourceGroupManager::addResourceLocation(const String& name,
const String& locType, const String& resGroup, bool recursive)
{
ResourceGroup* grp = getResourceGroup(resGroup);
if (!grp)
{
createResourceGroup(resGroup);
grp = getResourceGroup(resGroup);
}
OGRE_LOCK_MUTEX(grp->OGRE_AUTO_MUTEX_NAME) // lock group mutex
// Get archive
Archive* pArch = ArchiveManager::getSingleton().load( name, locType );
// Add to location list
ResourceLocation* loc = new ResourceLocation();
loc->archive = pArch;
loc->recursive = recursive;
grp->locationList.push_back(loc);
// Index resources
StringVectorPtr vec = pArch->find("*", recursive);
[color=red]//=========ERROR HERE=========[/color]
for(StringVector::iterator it=vec->begin(); it!=vec->end(); ++it )
{
// Index under full name, case sensitive
grp->resourceIndexCaseSensitive[(*it)] = pArch;
if (!pArch->isCaseSensitive())
{
// Index under lower case name too for case insensitive match
String indexName = (*it);
StringUtil::toLowerCase(indexName);
grp->resourceIndexCaseInsensitive[indexName] = pArch;
}
}
Thanks in advanced.