Use ensureDirectoryExists() instead of boost::filesystem directly.

Motivated by
 - proliferation of identical code
 - need to avoid strange behaviour with "." directory on some boost versions
 - potenial for further refactoring to avoid boost entirely
This commit is contained in:
Atgeirr Flø Rasmussen
2017-04-06 12:14:54 +02:00
parent d267c1a77d
commit 85e1544553
15 changed files with 53 additions and 216 deletions

View File

@@ -49,6 +49,7 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/simulators/ensureDirectoryExists.hpp>
#include <boost/filesystem.hpp>
@@ -212,13 +213,7 @@ try
if (output) {
output_dir =
param.getDefault("output_dir", std::string("output"));
boost::filesystem::path fpath(output_dir);
try {
create_directories(fpath);
}
catch (...) {
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
}
ensureDirectoryExists(output_dir);
std::string filename = output_dir + "/epoch_timing.param";
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
// open file to clean it. The file is appended to in SimulatorTwophase