Browse Source

Updates handling of output file

Caleb 5 years ago
parent
commit
7b487aae03
1 changed files with 10 additions and 4 deletions
  1. 10 4
      include/config.hpp

+ 10 - 4
include/config.hpp

@@ -164,16 +164,22 @@ namespace fv_util {
 
         std::string get_output_filename() {
             YAML::Node output_file = root["output-file"];
+            YAML::Node output_dir = root["output-dir"];
+            YAML::Node key = root["source-file-key"];
+            std::string full_path = ".";
+            if (output_dir) {
+                full_path = output_dir.as<std::string>();
+            }
             if (output_file) {
-                return output_file.as<std::string>();
+                full_path = full_path + "/" + output_file.as<std::string>();
             } else {
-                YAML::Node key = root["source-file-key"];
                 if (key) {
-                    return "../hists/" + key.as<std::string>() + ".root";
+                    full_path +=  "/" + key.as<std::string>() + ".root";
                 } else {
-                    return "../hists/output.root";
+                    full_path +=  "/output.root";
                 }
             }
+            return full_path;
         }
 
         std::vector<DataFileDescriptor> get_source_files() {