Skip to content

Commit

Permalink
Merge branch 'mkdir-out' into 'master'
Browse files Browse the repository at this point in the history
[cli] Create output directory.

See merge request ogs/ogs!4989
  • Loading branch information
TomFischer committed Apr 30, 2024
2 parents aa6a490 + 838d0ea commit 9090374
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Applications/CLI/ogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <tclap/CmdLine.h>

#include <chrono>
#include <filesystem>
#include <sstream>

#include "CommandLineArgumentParser.h"
Expand Down Expand Up @@ -64,6 +65,20 @@ int main(int argc, char* argv[])
INFO("This is OpenGeoSys-6 version {:s}.",
GitInfoLib::GitInfo::ogs_version);

{
std::error_code mkdir_err;
if (std::filesystem::create_directories(cli_arg.outdir, mkdir_err))
{
INFO("Output directory {:s} created.", cli_arg.outdir);
}
else if (mkdir_err.value() != 0)
{
WARN(
"Could not create output directory {:s}. Error code {:d}, {:s}",
cli_arg.outdir, mkdir_err.value(), mkdir_err.message());
}
}

BaseLib::RunTime run_time;

{
Expand Down

0 comments on commit 9090374

Please sign in to comment.