Skip to content
Snippets Groups Projects
Commit a8069699 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Fix check for non-existing file fir Windows case

parent 2c7ae542
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment