From Alberto Farre, fixes to the file path handling of internally referenced

files.
This commit is contained in:
Robert Osfield
2003-08-31 22:17:15 +00:00
parent 4c62cfe6e5
commit 6bb951a5bb

View File

@@ -1854,13 +1854,30 @@ osg::Group* ConvertFromFLT::visitMatrix(osg::Group& osgParent, const osg::Group&
return transform;
}
osg::Group* ConvertFromFLT::visitExternal(osg::Group& osgParent, ExternalRecord* rec)
{
// SExternalReference *pSExternal = (SExternalReference*)rec->getData();
osgDB::PushAndPopDataPath tmpfile(osgDB::getFilePath(rec->getFilename()));
std::string filePath = osgDB::getFilePath(rec->getFilename());
std::string pushAndPopPath;
//If absolute path
if( (filePath.length()>0 && filePath.find_first_of("/\\")==0) ||
(filePath.length()>2 && filePath.substr(1,1)==":" && filePath.find_first_of("/\\")==2) )
{
pushAndPopPath = filePath;
}
else
{
osgDB::FilePathList fpl = osgDB::getDataFilePathList();
pushAndPopPath = fpl.empty() ? "." : fpl.front();
if(pushAndPopPath.empty()) pushAndPopPath = ".";
pushAndPopPath += "/" + filePath;
}
osgDB::PushAndPopDataPath tmpfile(pushAndPopPath);
//osgDB::PushAndPopDataPath tmpfile(osgDB::getFilePath(rec->getFilename()));
FltFile* pFile = rec->getExternal();
osg::Group* external = NULL;
if (pFile)