diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b07999f5a801cfac48f85db87cff5ef1fbcba585..8a15fcce611e3f3f9b5179f0c51f4dee641fdf14 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -854,8 +854,8 @@ bool MainWindow::addPedestrianGroup(int groupID,QString fileName) // try to parse the txt file else if(fileName.endsWith(".txt",Qt::CaseInsensitive)) { - QString source_file=SaxParser::extractSourceFileTXT(fileName); - QString goal_file=SaxParser::extractGoalFileTXT(fileName); + QString source_file= wd + QDir::separator() + SaxParser::extractSourceFileTXT(fileName); + QString goal_file=wd + QDir::separator() + SaxParser::extractGoalFileTXT(fileName); QFileInfo check_file(source_file); if( !(check_file.exists() && check_file.isFile()) ) { diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp index 0b75fa50dccd705e119864afc75e641e6af4a4fd..55ae81dbca7561e6b0e70948b29622fd84adaa39 100644 --- a/src/SaxParser.cpp +++ b/src/SaxParser.cpp @@ -706,6 +706,8 @@ bool SaxParser::parseGeometryJPS(QString fileName, GeometryFactory& geoFac) Debug::Messages("wd: <%s>",wd.toStdString().c_str()); Building* building = new Building(); string geometrypath = fileName.toStdString(); + building->SetProjectRootDir(wd.toStdString()); + // read the geometry if(!building->LoadGeometry(geometrypath)) return false; diff --git a/src/geometry/Building.cpp b/src/geometry/Building.cpp index a5a00f2db0d83cfb4d9ca362a5364a2aa7e035f8..482384d11e61c1c1cc6a524ace77bede227cf7df 100644 --- a/src/geometry/Building.cpp +++ b/src/geometry/Building.cpp @@ -350,10 +350,12 @@ const std::string& Building::GetGeometryFilename() const bool Building::LoadGeometry(const std::string &geometryfile) { //get the geometry filename from the project file - string geoFilenameWithPath= _projectRootDir + geometryfile; + string geoFilenameWithPath= geometryfile; //_projectRootDir + + Debug::Messages("LoadGeometry: Root Dir: <%s>", _projectRootDir.c_str()); Debug::Messages("LoadGeometry: geometryfile: <%s>", geometryfile.c_str()); Debug::Messages("LoadGeometry: geoFilenameWithPath: <%s>", geoFilenameWithPath.c_str()); + if(geometryfile=="") { TiXmlDocument doc(_projectFilename); @@ -587,7 +589,7 @@ bool Building::LoadGeometry(const std::string &geometryfile) TiXmlNode * xNodeFile = xTransNode->FirstChild("file"); if(xNodeFile) { - std::string transFilename = xNodeFile->FirstChild()->ValueStr(); + std::string transFilename = _projectRootDir + "/" +xNodeFile->FirstChild()->ValueStr(); Log->Write("INFO:\tParsing transition from file <%s>", transFilename.c_str()); TiXmlDocument docTrans(transFilename); if (!docTrans.LoadFile()) {