From 5fabce7c2c89873410a992887a28e74db1256844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 10 May 2016 09:22:31 +0200 Subject: [PATCH] Check if dir already exists before creating. May be necessary on some platforms for the current dir ("."). --- opm/autodiff/FlowMain.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/opm/autodiff/FlowMain.hpp b/opm/autodiff/FlowMain.hpp index 08cc652a1..adffac8d3 100644 --- a/opm/autodiff/FlowMain.hpp +++ b/opm/autodiff/FlowMain.hpp @@ -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");