Check if dir already exists before creating.

May be necessary on some platforms for the current dir (".").
This commit is contained in:
Atgeirr Flø Rasmussen
2016-05-10 09:22:31 +02:00
parent 1671d493ea
commit 5fabce7c2c

View File

@@ -328,11 +328,13 @@ namespace Opm
output_dir_ =
param_.getDefault("output_dir", std::string("."));
boost::filesystem::path fpath(output_dir_);
try {
create_directories(fpath);
}
catch (...) {
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
if (!is_directory(fpath)) {
try {
create_directories(fpath);
}
catch (...) {
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
}
}
// Write simulation parameters.
param_.writeParam(output_dir_ + "/simulation.param");