From d79e00131bb4edde719f70842c5a3bbb089d9180 Mon Sep 17 00:00:00 2001
From: Mohcine Chraibi <m.chraibi@fz-juelich.de>
Date: Thu, 28 Apr 2016 19:48:54 +0200
Subject: [PATCH] Correct check for version of geometry

- General form of the location of "TraVisTo"-directory
---
 src/SystemSettings.cpp    | 4 ++--
 src/geometry/Building.cpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/SystemSettings.cpp b/src/SystemSettings.cpp
index 29d6788..ca45650 100644
--- a/src/SystemSettings.cpp
+++ b/src/SystemSettings.cpp
@@ -82,11 +82,10 @@ bool SystemSettings::onScreenInfos=true;
 
 bool SystemSettings::recordPNGsequence=false;
 //QString SystemSettings::outputDir =QDir::currentPath()+"/";
-QString SystemSettings::outputDir  = QDir::homePath() +"/Desktop/TraVisTo_Files/";
+QString SystemSettings::outputDir  = QDir::homePath() + QDir::separator() + "Desktop" + QDir::separator() + "TraVisTo_Files" + QDir::separator();
 QString SystemSettings::workingDir  = QDir::currentPath();
 QString SystemSettings::filesPrefix="";
 QString SystemSettings::logfile="log.txt";
-
 //the log file is writting by a different module
 OutputHandler* Log=NULL;
 
@@ -408,6 +407,7 @@ void SystemSettings::CreateLogfile()
         QDir dir;
         if(!dir.mkpath (outputDir )) {
             qDebug()<<"could not create directory: "<< outputDir;
+            qDebug()<<"could not create directory: "<< QDir::homePath();
             outputDir=""; // current
         }
     }
diff --git a/src/geometry/Building.cpp b/src/geometry/Building.cpp
index 1d125ab..cfab991 100644
--- a/src/geometry/Building.cpp
+++ b/src/geometry/Building.cpp
@@ -396,9 +396,9 @@ bool Building::LoadGeometry(const std::string &geometryfile)
 
      double version = xmltof(xRootNode->Attribute("version"), -1);
 
-     if (version != std::stod(JPS_VERSION) && version != std::stod(JPS_OLD_VERSION)) {
-          Log->Write(" \tWrong geometry version!");
-          Log->Write(" \tOnly version >= %s supported",JPS_VERSION);
+     if ( (version - std::stod(JPS_VERSION))*(version - std::stod(JPS_VERSION)) > 0.01*0.01){  //|| version != std::stod(JPS_OLD_VERSION)) {
+           Log->Write(" \tWrong geometry version %.2f!", version);
+           Log->Write(" \tOnly versions = %s or %s are supported",JPS_VERSION, JPS_OLD_VERSION);
           Log->Write(" \tPlease update the version of your geometry file to %s",JPS_VERSION);
           return false;
      }
-- 
GitLab