Another archive question
Posted: Fri May 14, 2010 7:24 pm
I am trying to load a mesh from a ZIP archive. It seems that the archive code doesn't apply the VIRTUAL working directory when searching for the file in the archive. In the archive it's "media/modelname/model.x" and the images are in the same directory. When I debug I never see the VIRTUAL working directory applied if I just pass in the file name "model.x" when using virtual directory "media/modelname". Is this a bug or as intended and I have to find another way of organizing my files?
I do the following:
And yes this is a ported version of Irrlicht to CodeGear Builder C++
I do the following:
Code: Select all
//backup current working dirs and set to model's dir
SceneManager->getFileSystem()->setFileListSystem ( io::FILESYSTEM_NATIVE );
io::path npath = SceneManager->getFileSystem()->getWorkingDirectory();
SceneManager->getFileSystem()->changeWorkingDirectoryTo(io::path(AnsiString(vsparams.MEDIA_PATH + modelName).c_str()));
SceneManager->getFileSystem()->setFileListSystem ( io::FILESYSTEM_VIRTUAL );
io::path vpath = SceneManager->getFileSystem()->getWorkingDirectory();
SceneManager->getFileSystem()->changeWorkingDirectoryTo(io::path(AnsiString("media\\" + modelName).c_str()));
// load mesh either from archive or natively
scene::ISceneNode* node = SceneManager->addAnimatedMeshSceneNode(SceneManager->getMesh(modelPath.c_str()), SceneManager->addEmptySceneNode(0));
// restore original working directories
SceneManager->getFileSystem()->setFileListSystem ( io::FILESYSTEM_VIRTUAL );
SceneManager->getFileSystem()->changeWorkingDirectoryTo(vpath);
SceneManager->getFileSystem()->setFileListSystem ( io::FILESYSTEM_NATIVE );
SceneManager->getFileSystem()->changeWorkingDirectoryTo(npath);