Skip to content
Snippets Groups Projects
Commit 838d0ea4 authored by Lars Bilke's avatar Lars Bilke Committed by Tom Fischer
Browse files

[cli] Create output directory.

Prints a warning on error, e.g.:

warning: Could not create output directory _out. Error code 17, File exists
parent cb03f906
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
#include <tclap/CmdLine.h>
#include <chrono>
#include <filesystem>
#include <sstream>
#include "CommandLineArgumentParser.h"
......@@ -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;
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment