From b8f91a09ebb705100d8b05c48a5e12adbb770c96 Mon Sep 17 00:00:00 2001 From: hxcan Date: Thu, 29 Mar 2012 16:56:38 +0800 Subject: [PATCH] Add a new environment variable "RECOLL_ACTIVE_EXTRA_DBS", which helps choose the active external indexes list. --- src/qtgui/guiutils.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index b9d6d272..ea629ed5 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -302,7 +302,28 @@ void rwSettings(bool writing) prefs.allExtraDbs.push_back(dbdir); } } - prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk); + + //Get the "active external indexes": + prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk); + const char *cp4Act; + if ((cp4Act = getenv("RECOLL_ACTIVE_EXTRA_DBS")) != 0) { + vector dbl; + stringToTokens(cp4Act, dbl, ":"); + for (vector::iterator dit = dbl.begin(); dit != dbl.end(); + dit++) { + string dbdir = path_canon(*dit); + path_catslash(dbdir); + if (std::find(prefs.activeExtraDbs.begin(), + prefs.activeExtraDbs.end(), dbdir) != + prefs.activeExtraDbs.end()) + continue; + if (!Rcl::Db::testDbDir(dbdir)) { + LOGERR(("Not a xapian index: [%s]\n", dbdir.c_str())); + continue; + } + prefs.activeExtraDbs.push_back(dbdir); + } //for + } //if } #if 0 {