diff --git a/Core/InputOutput/IntensityDataIOFactory.cpp b/Core/InputOutput/IntensityDataIOFactory.cpp index f0b14bbae73049f93871fc64ce250fb1484637c9..f5e88036fa246c422645c794be5cc5719d5ad821 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(); -} -}