dont autocreate config specified with -c or RECOLL_CONFDIR

This commit is contained in:
dockes 2007-02-07 17:17:11 +00:00
parent d1772cad7c
commit 75f1df098f
2 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.42 2007-02-06 14:16:43 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.43 2007-02-07 17:17:11 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -63,6 +63,10 @@ RclConfig::RclConfig(const string *argcnf)
m_datadir = cdatadir;
}
// We only do the automatic configuration creation thing for the default
// config dir, not if it was specified through -c or RECOLL_CONFDIR
bool autoconfdir = false;
// Command line config name overrides environment
if (argcnf && !argcnf->empty()) {
m_confdir = path_absolute(*argcnf);
@ -76,12 +80,25 @@ RclConfig::RclConfig(const string *argcnf)
if (cp) {
m_confdir = cp;
} else {
autoconfdir = true;
m_confdir = path_home();
m_confdir += ".recoll/";
}
}
if (!autoconfdir) {
// We want a recoll.conf file to exist in this case to avoid
// creating indexes all over the place
string conffile = path_cat(m_confdir, "recoll.conf");
if (access(conffile.c_str(), 0) < 0) {
m_reason = "Explicitely specified configuration must exist"
" (won't be automatically created)";
return;
}
}
if (access(m_confdir.c_str(), 0) < 0) {
if (!initUserConfig())
if (!initUserConfig())
return;
}

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.38 2007-02-02 10:27:44 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.39 2007-02-07 17:17:11 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -1595,12 +1595,16 @@ fvwm
<para>If the <filename>.recoll</filename> directory does not
exist when <command>recoll</command> or
<command>recollindex</command> are started, it
will be created with a set of empty configuration files.
<command>recoll</command> will give you a
chance to edit the configuration file before starting
indexing. <command>recollindex</command> will
proceed immediately.</para>
<command>recollindex</command> are started, it will be created
with a set of empty configuration files.
<command>recoll</command> will give you a chance to edit the
configuration file before starting
indexing. <command>recollindex</command> will proceed
immediately. To avoid mistakes, the automatic directory
creation will only occur for the
default location, not if <literal>-c</literal> or
<literal>RECOLL_CONFDIR</literal> were used (in the latter
cases, you will have to create the directory).</para>
<para>All configuration files share the same format. For