centralize dbdir computation in rclconfig+cat with conffdir if not absolute

This commit is contained in:
dockes
2006-04-28 07:54:38 +00:00
parent 220674f660
commit 47e1f82a91
7 changed files with 41 additions and 25 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.32 2006-04-25 09:59:12 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.33 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -369,13 +369,13 @@ bool ConfIndexer::index(bool resetbefore)
}
}
m_config->setKeyDir(doctopdir);
if (!m_config->getConfParam("dbdir", dbdir)) {
dbdir = m_config->getDbDir();
if (dbdir.empty()) {
LOGERR(("ConfIndexer::index: no database directory in "
"configuration for %s\n", doctopdir.c_str()));
m_reason = "No database directory set for " + doctopdir;
return false;
}
dbdir = path_tildexpand(dbdir);
dbit = dbmap.find(dbdir);
if (dbit == dbmap.end()) {
list<string> l;
+5 -8
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.18 2006-04-18 08:53:27 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: recollindex.cpp,v 1.19 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -48,14 +48,12 @@ static bool indexfiles(RclConfig *config, const list<string> &filenames)
// Note that we do not bother to check for multiple databases,
// which are currently a fiction anyway.
config->setKeyDir(path_getfather(*filenames.begin()));
string dbdir;
if (!config->getConfParam("dbdir", dbdir)) {
string dbdir = config->getDbDir();
if (dbdir.empty()) {
LOGERR(("indexfiles: no database directory in "
"configuration for %s\n", filenames.begin()->c_str()));
return false;
}
dbdir = path_tildexpand(dbdir);
dbindexer = new DbIndexer(config, dbdir);
return dbindexer->indexFiles(filenames);
}
@@ -65,12 +63,11 @@ static bool createstemdb(RclConfig *config, const string &lang)
{
// Note that we do not bother to check for multiple databases,
// which are currently a fiction anyway.
string dbdir;
if (!config->getConfParam("dbdir", dbdir)) {
string dbdir = config->getDbDir();
if (dbdir.empty()) {
LOGERR(("createstemdb: no database directory in configuration\n"));
return false;
}
dbdir = path_tildexpand(dbdir);
dbindexer = new DbIndexer(config, dbdir);
return dbindexer->createStemDb(lang);
}