Add -c <confdir> option to recoll and recollindex
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.29 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.30 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -41,7 +41,7 @@ static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.29 2006-04-28 07:54:38 dockes E
|
||||
using namespace std;
|
||||
#endif /* NO_NAMESPACES */
|
||||
|
||||
RclConfig::RclConfig()
|
||||
RclConfig::RclConfig(const string *argcnf)
|
||||
{
|
||||
zeroMe();
|
||||
// Compute our data dir name, typically /usr/local/share/recoll
|
||||
@@ -53,14 +53,18 @@ RclConfig::RclConfig()
|
||||
m_datadir = cdatadir;
|
||||
}
|
||||
|
||||
const char *cp = getenv("RECOLL_CONFDIR");
|
||||
if (cp) {
|
||||
m_confdir = cp;
|
||||
// Command line config name overrides environment
|
||||
if (argcnf && !argcnf->empty()) {
|
||||
m_confdir = *argcnf;
|
||||
} else {
|
||||
m_confdir = path_home();
|
||||
m_confdir += ".recoll/";
|
||||
const char *cp = getenv("RECOLL_CONFDIR");
|
||||
if (cp) {
|
||||
m_confdir = cp;
|
||||
} else {
|
||||
m_confdir = path_home();
|
||||
m_confdir += ".recoll/";
|
||||
}
|
||||
}
|
||||
|
||||
if (access(m_confdir.c_str(), 0) < 0) {
|
||||
if (!initUserConfig())
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef _RCLCONFIG_H_INCLUDED_
|
||||
#define _RCLCONFIG_H_INCLUDED_
|
||||
/* @(#$Id: rclconfig.h,v 1.20 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: rclconfig.h,v 1.21 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class RclConfig {
|
||||
public:
|
||||
|
||||
RclConfig();
|
||||
RclConfig(const string *argcnf=0);
|
||||
bool ok() {return m_ok;}
|
||||
const string &getReason() {return m_reason;}
|
||||
/** Return the directory where this config is stored */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.5 2006-03-29 11:18:14 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.6 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -27,7 +27,7 @@ static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.5 2006-03-29 11:18:14 dockes Exp
|
||||
#include "rclinit.h"
|
||||
|
||||
RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
||||
string &reason)
|
||||
string &reason, const string *argcnf)
|
||||
{
|
||||
if (cleanup)
|
||||
atexit(cleanup);
|
||||
@@ -43,7 +43,7 @@ RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
||||
}
|
||||
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
||||
DebugLog::setfilename("stderr");
|
||||
RclConfig *config = new RclConfig;
|
||||
RclConfig *config = new RclConfig(argcnf);
|
||||
if (!config || !config->ok()) {
|
||||
reason = "Configuration could not be built:\n";
|
||||
if (config)
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
*/
|
||||
#ifndef _RCLINIT_H_INCLUDED_
|
||||
#define _RCLINIT_H_INCLUDED_
|
||||
/* @(#$Id: rclinit.h,v 1.3 2006-01-30 11:15:27 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: rclinit.h,v 1.4 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
class RclConfig;
|
||||
|
||||
extern RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
||||
std::string &reason);
|
||||
std::string &reason,
|
||||
const std::string *argcnf = 0);
|
||||
|
||||
#endif /* _RCLINIT_H_INCLUDED_ */
|
||||
|
||||
Reference in New Issue
Block a user