From cb8700c34bcf988377fe6660cb91e9f130cc3cee Mon Sep 17 00:00:00 2001
From: Marco De Marco <demarco@oats.inaf.it>
Date: Fri, 14 Mar 2014 10:02:23 +0100
Subject: [PATCH] Pre processor call fix added

---
 src/ScriptManager.cpp | 23 +++++++++++++----------
 src/WorkerThread.cpp  |  2 ++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/ScriptManager.cpp b/src/ScriptManager.cpp
index ce142c3..41450a4 100644
--- a/src/ScriptManager.cpp
+++ b/src/ScriptManager.cpp
@@ -108,17 +108,20 @@ void ScriptManager::preProcessFile(boost::filesystem::path& filePath)
 
     std::string result = exec(command.str());
 
-    if(result.find("PROCESS FATAL") != std::string::npos)
+    if(result.find("PROCESS OK") == std::string::npos)
     {
-        std::stringstream errorStream;
-        errorStream << "Pre process error: " << result;
-        throw std::runtime_error(errorStream.str());
-    }
-    else
-    {
-        std::stringstream errorStream;
-        errorStream << "Unknown pre process error: " << result;
-        throw std::runtime_error(errorStream.str());
+        if(result.find("PROCESS FATAL") != std::string::npos)
+        {
+            std::stringstream errorStream;
+            errorStream << "Pre process error: " << result;
+            throw std::runtime_error(errorStream.str());
+        }
+        else
+        {
+            std::stringstream errorStream;
+            errorStream << "Unknown pre process error: " << result;
+            throw std::runtime_error(errorStream.str());
+        }
     }
 }
 
diff --git a/src/WorkerThread.cpp b/src/WorkerThread.cpp
index a4d3720..a90a830 100644
--- a/src/WorkerThread.cpp
+++ b/src/WorkerThread.cpp
@@ -75,6 +75,8 @@ void WorkerThread::workerLoop()
                 }
                 while(boost::chrono::steady_clock::now()-start <= waitTime);
 
+                m_fileManager_sp->preProcessFile(origPath);
+
                 copyToDestination(origPath);
 
                 if(verified)
-- 
GitLab