mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-15 21:33:25 -06:00
Merge pull request #1995 from atgeirr/fix-missing-log-files
Ensure output dir exists before creating log streams.
This commit is contained in:
commit
12c38788bc
@ -53,6 +53,8 @@
|
|||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
|
||||||
|
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#if HAVE_DUNE_FEM
|
#if HAVE_DUNE_FEM
|
||||||
#include <dune/fem/misc/mpimanager.hh>
|
#include <dune/fem/misc/mpimanager.hh>
|
||||||
#else
|
#else
|
||||||
@ -127,10 +129,26 @@ enum class FileOutputMode {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ensureOutputDirExists(const std::string& cmdline_output_dir)
|
||||||
|
{
|
||||||
|
if (!boost::filesystem::is_directory(cmdline_output_dir)) {
|
||||||
|
try {
|
||||||
|
boost::filesystem::create_directories(cmdline_output_dir);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
throw std::runtime_error("Creation of output directory '" + cmdline_output_dir + "' failed\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup the OpmLog backends
|
// Setup the OpmLog backends
|
||||||
FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, const std::string& cmdline_output_dir, const std::string& cmdline_output, bool output_cout_, const std::string& stdout_log_id) {
|
FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, const std::string& cmdline_output_dir, const std::string& cmdline_output, bool output_cout_, const std::string& stdout_log_id) {
|
||||||
|
|
||||||
|
if (!cmdline_output_dir.empty()) {
|
||||||
|
ensureOutputDirExists(cmdline_output_dir);
|
||||||
|
}
|
||||||
|
|
||||||
// create logFile
|
// create logFile
|
||||||
using boost::filesystem::path;
|
using boost::filesystem::path;
|
||||||
path fpath(deck_filename);
|
path fpath(deck_filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user