瀏覽代碼

Updates handling of output file

Caleb 6 年之前
父節點
當前提交
7b487aae03
共有 1 個文件被更改,包括 10 次插入4 次删除
  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() {