Merge pull request #289 from totto82/fix_default_output_dir

Fix default output directory
This commit is contained in:
Atgeirr Flø Rasmussen 2018-02-19 17:04:41 +01:00 committed by GitHub
commit 875aafe0f9

View File

@ -347,8 +347,16 @@ public:
PolymerModule::initFromDeck(vanguard.deck(), vanguard.eclState()); PolymerModule::initFromDeck(vanguard.deck(), vanguard.eclState());
if (EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput)) { if (EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput)) {
// retrieve the location where the output is supposed to go // retrieve the location set by the user
const auto& outputDir = EWOMS_GET_PARAM(TypeTag, std::string, EclOutputDir); 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 // ensure that the output directory exists and that it is a directory
if (outputDir != ".") { // Do not try to create the current 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 // specify the directory output. This is not a very nice mechanism because
// the eclState is supposed to be immutable here, IMO. // the eclState is supposed to be immutable here, IMO.
auto& eclState = this->simulator().vanguard().eclState();
auto& ioConfig = eclState.getIOConfig();
ioConfig.setOutputDir(outputDir); ioConfig.setOutputDir(outputDir);
// create the actual ECL writer // create the actual ECL writer