support dumping whole subdir from gh pages

This commit is contained in:
John
2024-07-07 19:36:00 +02:00
parent b22a1135f5
commit ef4d68930f
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -263,7 +263,7 @@ int main(int argc, char* argv[], char* envp[]) {
if (configPath.find("://") == string::npos) { if (configPath.find("://") == string::npos) {
configLocalPrefix = s_opt.configPath; configLocalPrefix = s_opt.configPath;
} else { } 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 logWrite(lf_main, ll_error, "invalid configpath without scanconfig"); // force logging on exit
return EINVAL; return EINVAL;
} }
+2 -2
View File
@@ -148,7 +148,7 @@ static const argDef argDefs[] = {
{"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTPS URL) [" {"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTPS URL) ["
CONFIG_PATH "]"}, CONFIG_PATH "]"},
{"scanconfig", 's', "ADDR", af_optional, "Pick CSV config files matching initial scan ADDR: " {"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, " "\"none\" for no initial scan message, "
"\"full\" for full scan, " "\"full\" for full scan, "
"a single hex address to scan, or " "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; return ret;
} }
if (!opt->readOnly && !opt->scanConfigOrPathSet) { if (!opt->readOnly && !opt->scanConfigOrPathSet && opt->dumpConfig == OF_NONE) {
opt->scanConfig = true; opt->scanConfig = true;
opt->initialScan = BROADCAST; opt->initialScan = BROADCAST;
} }
+7
View File
@@ -102,6 +102,13 @@ result_t ScanHelper::collectConfigFiles(const string& relPath, const string& pre
} }
continue; 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) if (prefix.length() == 0 ? (!ignoreAddressPrefix || name.length() < 3 || name.find_first_of('.') != 2)
: (name.length() >= prefix.length() && name.substr(0, prefix.length()) == prefix)) { : (name.length() >= prefix.length() && name.substr(0, prefix.length()) == prefix)) {
files->push_back(relPathWithSlash + name); files->push_back(relPathWithSlash + name);