diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8f46d9c9795b7025ed6c64d276b19d02b5e45c49..648d966976b1a0696b03a084f215a355f7a43ac7 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -765,8 +765,10 @@ bool MainWindow::addPedestrianGroup(int groupID,QString fileName) if(! SaxParser::parseGeometryJPS(geometry_file,geometry)) { int res = QMessageBox::warning(this, "Errors in Geometry. Continue Parsing?", "JuPedSim has detected an error in the supplied geometry.\n" + "<" + +geometry_file+ + ">" "The simulation will likely fail using this geometry.\n" - "Also make sure to validate your file.\n" "More information are provided in the log file:\n" +SystemSettings::getLogfile()+ "\n\nShould I try to parse and display what I can?" diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp index 585686f5f1044196b605826043eed077ea2500d1..145e247b310c0d80e12dd927504e9d33035d77ca 100644 --- a/src/SaxParser.cpp +++ b/src/SaxParser.cpp @@ -678,16 +678,21 @@ bool SaxParser::parseGeometryJPS(QString fileName, GeometryFactory& geoFac) Debug::Messages( "Enter SaxParser::parseGeometryJPS with filename <%s>",fileName.toStdString().c_str()); double captionsColor=0;//red - if(!fileName.endsWith(".xml",Qt::CaseInsensitive)) return false; + QDir fileDir(fileName); QString wd; QDir dir(wd); SystemSettings::getWorkingDirectory(wd); - QString s = dir.relativeFilePath(fileName); - fileName=wd + QDir::separator() + s; + + if(!fileName.endsWith(".xml",Qt::CaseInsensitive)) return false; + if(!fileDir.isAbsolute()) + { + QString s = dir.relativeFilePath(fileName); + fileName=wd + QDir::separator() + s; + } + // QString = QDir::cleanPath(wd + QDir::separator() + fileName); Debug::Messages("filename: <%s)", fileName.toStdString().c_str()); Debug::Messages("wd: <%s>",wd.toStdString().c_str()); - Building* building = new Building(); string geometrypath = fileName.toStdString(); // read the geometry