diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 294f3115..3f7dd701 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -251,6 +251,33 @@ static bool createstemdb(RclConfig *config, const string &lang) return confindexer->createStemDb(lang); } +static bool checktopdirs(RclConfig *config) +{ + vector 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::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 usage [] = @@ -399,6 +426,9 @@ int main(int argc, char **argv) } o_reexec->atexit(cleanup); + if (!checktopdirs(config)) + exit(1); + string rundir; config->getConfParam("idxrundir", rundir); if (!rundir.compare("tmp")) {