From a6bffeffcba196caa389b69dc2f5041f40004141 Mon Sep 17 00:00:00 2001 From: Ian Reed Date: Sat, 4 Nov 2023 10:50:36 -0700 Subject: [PATCH] Updates to local path creation --- rapido/src/hepcli.cc | 17 +++++++++++++++++ rapido/src/hepcli.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/rapido/src/hepcli.cc b/rapido/src/hepcli.cc index 17299aa..0644cbd 100644 --- a/rapido/src/hepcli.cc +++ b/rapido/src/hepcli.cc @@ -117,6 +117,23 @@ void HEPCLI::parse(int argc, char** argv) is_signal = is_signal_flag; debug = debug_flag; + // Make local directories as needed for the output + std::vector sub_dirs; + size_t start = 0; + size_t end; + + while ((end = output_dir.find('/',start)) != std::string::npos) + { + sub_dirs.push_back(output_dir.substr(0,end)); + start = end + 1; + } + sub_dirs.push_back(output_dir); + + for (const std::string& sub_dir : sub_dirs) + { + mkdir(sub_dir.c_str(), 0777); + } + // Read all non-optioned arguments as input file paths int n_input_files = 0; input_tchain = new TChain(input_ttree.c_str()); diff --git a/rapido/src/hepcli.h b/rapido/src/hepcli.h index b642683..5d42a9d 100644 --- a/rapido/src/hepcli.h +++ b/rapido/src/hepcli.h @@ -7,6 +7,10 @@ #include #include +#include +#include +#include + #include "TChain.h" /**