Skip to content

Commit

Permalink
First pass to address reviewer's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stcui007 committed Jul 23, 2024
1 parent 35f90b8 commit 1342d2b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions include/realizations/catchment/Formulation_Manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sys/stat.h>
#include <regex>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>

Expand All @@ -26,8 +25,6 @@
#include "realizations/config/config.hpp"
#include "realizations/config/layer.hpp"

#include<iostream>

namespace realization {

class Formulation_Manager {
Expand Down Expand Up @@ -278,8 +275,8 @@ namespace realization {

/**
* @brief Get the formatted output root: check the existence of the output_root directory defined
* in realization. If true, return the directory name. Otherwise, throw a runtime error and
* request the user to create that directory
* in realization. If true, return the directory name. Otherwise, try to create the directory
* or throw an error on failure.
*
* @code{.cpp}
* // Example config:
Expand Down Expand Up @@ -309,9 +306,11 @@ namespace realization {
if (stat(dir, &sb) == 0 && S_ISDIR(sb.st_mode))
return dir;
else {
//throw std::runtime_error("output_root directory does not exist, please create one matching that in realization");
mkdir(dir, 0755);
return dir;
int result = mkdir(dir, 0755);
if (result == 0)
return dir;
else
throw std::runtime_error("mkdir " + std::string(dir) + " failed, please create " + std::string(dir));
}
}

Expand Down

0 comments on commit 1342d2b

Please sign in to comment.