From ef4d68930f03c88dad97fb381f2d2ec2f3a4f063 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 7 Jul 2024 19:36:00 +0200 Subject: [PATCH] support dumping whole subdir from gh pages --- src/ebusd/main.cpp | 2 +- src/ebusd/main_args.cpp | 4 ++-- src/ebusd/scan.cpp | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index 1f7c7a92..bf8b83ee 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -263,7 +263,7 @@ int main(int argc, char* argv[], char* envp[]) { if (configPath.find("://") == string::npos) { configLocalPrefix = s_opt.configPath; } else { - if (!s_opt.scanConfig) { + if (!s_opt.scanConfig && s_opt.dumpConfig == OF_NONE) { logWrite(lf_main, ll_error, "invalid configpath without scanconfig"); // force logging on exit return EINVAL; } diff --git a/src/ebusd/main_args.cpp b/src/ebusd/main_args.cpp index 236e7295..38f426ab 100755 --- a/src/ebusd/main_args.cpp +++ b/src/ebusd/main_args.cpp @@ -148,7 +148,7 @@ static const argDef argDefs[] = { {"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTPS URL) [" CONFIG_PATH "]"}, {"scanconfig", 's', "ADDR", af_optional, "Pick CSV config files matching initial scan ADDR: " - "empty for broadcast ident message (default when configpath is not given), " + "empty for broadcast ident message (default when neither configpath nor dumpconfig is not given), " "\"none\" for no initial scan message, " "\"full\" for full scan, " "a single hex address to scan, or " @@ -667,7 +667,7 @@ int parse_main_args(int argc, char* argv[], char* envp[], options_t *opt) { return ret; } - if (!opt->readOnly && !opt->scanConfigOrPathSet) { + if (!opt->readOnly && !opt->scanConfigOrPathSet && opt->dumpConfig == OF_NONE) { opt->scanConfig = true; opt->initialScan = BROADCAST; } diff --git a/src/ebusd/scan.cpp b/src/ebusd/scan.cpp index 2a018654..3ae6a516 100644 --- a/src/ebusd/scan.cpp +++ b/src/ebusd/scan.cpp @@ -102,6 +102,13 @@ result_t ScanHelper::collectConfigFiles(const string& relPath, const string& pre } continue; } + if (name.back() == '/') { + // directory + if (dirs != nullptr) { + dirs->push_back(relPathWithSlash + name.substr(0, name.length() - 1)); + } + continue; + } if (prefix.length() == 0 ? (!ignoreAddressPrefix || name.length() < 3 || name.find_first_of('.') != 2) : (name.length() >= prefix.length() && name.substr(0, prefix.length()) == prefix)) { files->push_back(relPathWithSlash + name);