Allow defining monitordirs variable: subset/dir of topdirs which will get monitored for updates

This commit is contained in:
Jean-Francois Dockes
2018-04-11 17:45:06 +02:00
parent 68e6b9f8d0
commit 8559572c7e
6 changed files with 90 additions and 28 deletions
+13 -7
View File
@@ -585,18 +585,24 @@ pair<int,int> RclConfig::getThrConf(ThrStage who) const
return m_thrConf[who];
}
vector<string> RclConfig::getTopdirs() const
vector<string> RclConfig::getTopdirs(bool formonitor) const
{
vector<string> tdl;
if (!getConfParam("topdirs", &tdl)) {
LOGERR("RclConfig::getTopdirs: no top directories in config or "
"bad list format\n");
if (formonitor) {
if (!getConfParam("monitordirs", &tdl)) {
getConfParam("topdirs", &tdl);
}
} else {
getConfParam("topdirs", &tdl);
}
if (tdl.empty()) {
LOGERR("RclConfig::getTopdirs: nothing to index: topdirs/monitordirs "
" are not set or have a bad list format\n");
return tdl;
}
for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
*it = path_tildexpand(*it);
*it = path_canon(*it);
for (auto& dir : tdl) {
dir = path_canon(path_tildexpand(dir));
}
return tdl;
}
+5 -2
View File
@@ -182,8 +182,11 @@ class RclConfig {
/** Get list of top directories. This is needed from a number of places
* and needs some cleaning-up code. An empty list is always an error, no
* need for other status */
vector<string> getTopdirs() const;
* need for other status
* @param formonitor if set retrieve the list for real time monitoring
* (if the monitor list does not exist we return the normal one).
*/
vector<string> getTopdirs(bool formonitor = false) const;
string getConfdirPath(const char *varname, const char *dflt) const;
string getCachedirPath(const char *varname, const char *dflt) const;