Example #1
0
void SoundBank::openFile(std::string path, std::string id, int index)
{
	std::string foundPath = path;
	Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
	Ogre::String group = groupManager->findGroupContainingResource(path) ;
	Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
	Ogre::FileInfoList::iterator it = fileInfos->begin();
	if(it != fileInfos->end())
	{
		foundPath = it->archive->getName() + "/" + foundPath;
	}
	else
	{
		foundPath = "";
	}

	this->addSound(new SoundChunk(foundPath), id, index);
}
        std::string findFilePath(const std::string& filename)
        {
          // on demand init
          Model::initRessources() ;
          
          std::string foundPath = filename;
          Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
          Ogre::String group = groupManager->findGroupContainingResource(filename) ;
          Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
          Ogre::FileInfoList::iterator it = fileInfos->begin();
          if(it != fileInfos->end())
          {
            foundPath = it->archive->getName() + "/" + foundPath;
            foundPath;
          }
          else
            foundPath = "";

          return foundPath;
        }