From 27beb2faec66cf9ec96e86dbb6e264bdee3201a1 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 19 Feb 2018 13:10:34 +0100 Subject: [PATCH] Fix default output directory Get default ecl output directory from IOConfig. --- ebos/eclproblem.hh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 3fdb3b745..2a7cf60aa 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -347,8 +347,16 @@ public: PolymerModule::initFromDeck(vanguard.deck(), vanguard.eclState()); if (EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput)) { - // retrieve the location where the output is supposed to go - const auto& outputDir = EWOMS_GET_PARAM(TypeTag, std::string, EclOutputDir); + // retrieve the location set by the user + std::string outputDir = EWOMS_GET_PARAM(TypeTag, std::string, EclOutputDir); + + auto& eclState = this->simulator().vanguard().eclState(); + auto& ioConfig = eclState.getIOConfig(); + if (outputDir == ".") { + // Default output directory is the directory where the deck is found. + const std::string default_output_dir = ioConfig.getOutputDir(); + outputDir = default_output_dir; + } // ensure that the output directory exists and that it is a directory if (outputDir != ".") { // Do not try to create the current directory. @@ -364,8 +372,6 @@ public: // specify the directory output. This is not a very nice mechanism because // the eclState is supposed to be immutable here, IMO. - auto& eclState = this->simulator().vanguard().eclState(); - auto& ioConfig = eclState.getIOConfig(); ioConfig.setOutputDir(outputDir); // create the actual ECL writer