From a8069699bdd68b8669c33de07f92ba1494c9d34f Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Wed, 24 Jul 2019 13:29:45 +0200
Subject: [PATCH] Fix check for non-existing file fir Windows case

---
 Core/InputOutput/IntensityDataIOFactory.cpp | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/Core/InputOutput/IntensityDataIOFactory.cpp b/Core/InputOutput/IntensityDataIOFactory.cpp
index f0b14bbae73..f5e88036fa2 100644
--- a/Core/InputOutput/IntensityDataIOFactory.cpp
+++ b/Core/InputOutput/IntensityDataIOFactory.cpp
@@ -17,18 +17,13 @@
 #include "OutputDataReadFactory.h"
 #include "OutputDataWriteFactory.h"
 #include "SimulationResult.h"
-
+#include "FileSystemUtils.h"
 #include <fstream>
 #include <memory>
 
-namespace {
-bool FileExists(const std::string& filename);
-}
-
-
 OutputData<double>* IntensityDataIOFactory::readOutputData(const std::string& file_name)
 {
-    if (!FileExists(file_name))
+    if (!FileSystemUtils::IsFileExists(file_name))
         return nullptr;
     std::unique_ptr<OutputDataReader> P_reader(OutputDataReadFactory::getReader(file_name));
     if (P_reader)
@@ -38,7 +33,7 @@ OutputData<double>* IntensityDataIOFactory::readOutputData(const std::string& fi
 
 OutputData<double>* IntensityDataIOFactory::readReflectometryData(const std::string& file_name)
 {
-    if (!FileExists(file_name))
+    if (!FileSystemUtils::IsFileExists(file_name))
         return nullptr;
     std::unique_ptr<OutputDataReader> P_reader(OutputDataReadFactory::getReflectometryReader(file_name));
     if (P_reader)
@@ -73,10 +68,3 @@ void IntensityDataIOFactory::writeSimulationResult(const SimulationResult& resul
     std::unique_ptr<OutputData<double>> P_data(result.data());
     writeOutputData(*P_data, file_name);
 }
-
-namespace {
-bool FileExists(const std::string& filename) {
-    std::ifstream fs(filename);
-    return fs.is_open();
-}
-}
-- 
GitLab