Skip to content

Commit

Permalink
support dumping whole subdir from gh pages
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Jul 7, 2024
1 parent b22a113 commit ef4d689
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ebusd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ebusd/main_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions src/ebusd/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ef4d689

Please sign in to comment.