Check that all topdirs elements are absolute paths
This commit is contained in:
parent
be764dbb8a
commit
a6e1ebd92c
1 changed files with 30 additions and 0 deletions
|
@ -251,6 +251,33 @@ static bool createstemdb(RclConfig *config, const string &lang)
|
||||||
return confindexer->createStemDb(lang);
|
return confindexer->createStemDb(lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool checktopdirs(RclConfig *config)
|
||||||
|
{
|
||||||
|
vector<string> tdl;
|
||||||
|
if (!config->getConfParam("topdirs", &tdl)) {
|
||||||
|
cerr << "No 'topdirs' parameter in configuration\n";
|
||||||
|
LOGERR(("recollindex:No 'topdirs' parameter in configuration\n"));;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
|
||||||
|
*it = path_tildexpand(*it);
|
||||||
|
if (!it->size() || (*it)[0] != '/') {
|
||||||
|
if ((*it)[0] == '~') {
|
||||||
|
cerr << "Tilde expansion failed: " << *it << endl;
|
||||||
|
LOGERR(("recollindex: tilde expansion failed: %s\n",
|
||||||
|
it->c_str()));
|
||||||
|
} else {
|
||||||
|
cerr << "Not an absolute path: " << *it << endl;
|
||||||
|
LOGERR(("recollindex: not an absolute path: %s\n",
|
||||||
|
it->c_str()));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *thisprog;
|
static const char *thisprog;
|
||||||
|
|
||||||
static const char usage [] =
|
static const char usage [] =
|
||||||
|
@ -399,6 +426,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
o_reexec->atexit(cleanup);
|
o_reexec->atexit(cleanup);
|
||||||
|
|
||||||
|
if (!checktopdirs(config))
|
||||||
|
exit(1);
|
||||||
|
|
||||||
string rundir;
|
string rundir;
|
||||||
config->getConfParam("idxrundir", rundir);
|
config->getConfParam("idxrundir", rundir);
|
||||||
if (!rundir.compare("tmp")) {
|
if (!rundir.compare("tmp")) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue