From 75f1df098fd855ffb7625d1cc7d0d55318efa2ad Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 7 Feb 2007 17:17:11 +0000 Subject: [PATCH] dont autocreate config specified with -c or RECOLL_CONFDIR --- src/common/rclconfig.cpp | 21 +++++++++++++++++++-- src/doc/user/usermanual.sgml | 18 +++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index c0d3d2d1..d5db5042 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -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; } diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml index 7f1de47e..790a713b 100644 --- a/src/doc/user/usermanual.sgml +++ b/src/doc/user/usermanual.sgml @@ -24,7 +24,7 @@ Dockes - $Id: usermanual.sgml,v 1.38 2007-02-02 10:27:44 dockes Exp $ + $Id: usermanual.sgml,v 1.39 2007-02-07 17:17:11 dockes Exp $ This document introduces full text search notions @@ -1595,12 +1595,16 @@ fvwm If the .recoll directory does not exist when recoll or - recollindex are started, it - will be created with a set of empty configuration files. - recoll will give you a - chance to edit the configuration file before starting - indexing. recollindex will - proceed immediately. + recollindex are started, it will be created + with a set of empty configuration files. + recoll will give you a chance to edit the + configuration file before starting + indexing. recollindex will proceed + immediately. To avoid mistakes, the automatic directory + creation will only occur for the + default location, not if -c or + RECOLL_CONFDIR were used (in the latter + cases, you will have to create the directory). All configuration files share the same format. For