Index: code/ObjFileImporter.cpp =================================================================== --- code/ObjFileImporter.cpp (revision 470) +++ code/ObjFileImporter.cpp (working copy) @@ -104,11 +104,9 @@ TextFileToBuffer(file.get(),m_Buffer); // - std::string strDirectory( 1, io.getOsSeparator() ), strModelName; - std::string::size_type pos = pFile.find_last_of( io.getOsSeparator() ); - if ( pos != std::string::npos ) - { - strDirectory = pFile.substr(0, pos); + std::string strModelName; + std::string::size_type pos = pFile.find_last_of( "\\/" ); + if ( pos != std::string::npos ) { strModelName = pFile.substr(pos+1, pFile.size() - pos - 1); } else @@ -117,7 +115,7 @@ } // parse the file into a temporary representation - ObjFileParser parser(m_Buffer, strDirectory, strModelName, pIOHandler); + ObjFileParser parser(m_Buffer, strModelName, pIOHandler); // And create the proper return structures out of it CreateDataFromImport(parser.GetModel(), pScene); Index: code/ObjFileParser.cpp =================================================================== --- code/ObjFileParser.cpp (revision 470) +++ code/ObjFileParser.cpp (working copy) @@ -57,10 +57,7 @@ // ------------------------------------------------------------------- // Constructor with loaded data and directories. -ObjFileParser::ObjFileParser(std::vector &Data, - const std::string &strAbsPath, - const std::string &strModelName, IOSystem* _io) : - m_strAbsPath(strAbsPath), +ObjFileParser::ObjFileParser(std::vector &Data,const std::string &strModelName, IOSystem* _io) : m_DataIt(Data.begin()), m_DataItEnd(Data.end()), m_pModel(NULL), @@ -440,13 +437,12 @@ m_DataIt++; // Check for existence - std::string strMatName(pStart, &(*m_DataIt)); - std::string absName = m_strAbsPath + io->getOsSeparator() + strMatName; - IOStream *pFile = io->Open(absName.c_str()); + const std::string strMatName(pStart, &(*m_DataIt)); + IOStream *pFile = io->Open(strMatName); if (!pFile ) { - DefaultLogger::get()->error("OBJ: Unable to locate material file " + absName); + DefaultLogger::get()->error("OBJ: Unable to locate material file " + strMatName); m_DataIt = skipLine( m_DataIt, m_DataItEnd, m_uiLine ); return; } @@ -457,7 +453,7 @@ io->Close( pFile ); // Importing the material library - ObjFileMtlImporter mtlImporter( buffer, absName, m_pModel ); + ObjFileMtlImporter mtlImporter( buffer, strMatName, m_pModel ); } // ------------------------------------------------------------------- Index: code/ObjFileParser.h =================================================================== --- code/ObjFileParser.h (revision 470) +++ code/ObjFileParser.h (working copy) @@ -72,7 +72,7 @@ public: /// \brief Constructor with data array. - ObjFileParser(std::vector &Data, const std::string &strAbsPath, const std::string &strModelName, IOSystem* io); + ObjFileParser(std::vector &Data,const std::string &strModelName, IOSystem* io); /// \brief Destructor ~ObjFileParser(); /// \brief Model getter. @@ -114,8 +114,6 @@ private: /// Default material name static const std::string DEFAULT_MATERIAL;/* = "defaultmaterial";*/ - //! Absolute filepath to model - std::string m_strAbsPath; //! Iterator to current position in buffer DataArrayIt m_DataIt; //! Iterator to end position of buffer