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
+18 -1
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.28 2006-04-20 09:20:09 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.29 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
@@ -272,6 +272,23 @@ string RclConfig::getMimeIconName(const string &mtype, string *path)
return iconname;
}
string RclConfig::getDbDir()
{
string dbdir;
if (!getConfParam("dbdir", dbdir)) {
LOGERR(("RclConfig::getDbDir: no db directory in configuration\n"));
} else {
dbdir = path_tildexpand(dbdir);
// If not an absolute path, compute relative to config dir
if (dbdir.at(0) != '/') {
LOGDEB1(("Dbdir not abs, catting with confdir\n"));
dbdir = path_cat(m_confdir, dbdir);
}
}
LOGDEB1(("RclConfig::getDbDir: dbdir: [%s]\n", dbdir.c_str()));
return dbdir;
}
// Look up an executable filter. We look in $RECOLL_FILTERSDIR,
// filtersdir in config file, then let the system use the PATH
+4 -1
View File
@@ -16,7 +16,7 @@
*/
#ifndef _RCLCONFIG_H_INCLUDED_
#define _RCLCONFIG_H_INCLUDED_
/* @(#$Id: rclconfig.h,v 1.19 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rclconfig.h,v 1.20 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes */
#include <list>
@@ -53,12 +53,15 @@ class RclConfig {
bool getConfParam(const std::string &name, int *value);
/** Variant with autoconversion to bool */
bool getConfParam(const std::string &name, bool *value);
/** Get default charset for current keydir (was set during setKeydir)
* filenames are handled differently */
const string &getDefCharset(bool filename = false);
/** Get guessCharset for current keydir (was set during setKeydir) */
bool getGuessCharset() {return guesscharset;}
/** Get database directory */
string getDbDir();
/**
* Get list of ignored suffixes from mimemap