Windows: use ; not : as separator in RECOLL_EXTRA_DBS env variable

This commit is contained in:
Jean-Francois Dockes 2022-05-18 17:07:53 +01:00
parent b9de1ed07e
commit 1be54c2709

View File

@ -47,6 +47,12 @@ RclDynConf *g_dynconf;
AdvSearchHist *g_advshistory; AdvSearchHist *g_advshistory;
RclConfig *theconfig; RclConfig *theconfig;
#ifdef _WIN32
static const std::string dirlistsep{";"};
#else
static const std::string dirlistsep{":"};
#endif
// The table should not be necessary, but I found no css way to get // The table should not be necessary, but I found no css way to get
// qt 4.6 qtextedit to clear the margins after the float img without // qt 4.6 qtextedit to clear the margins after the float img without
// introducing blank space. // introducing blank space.
@ -314,7 +320,7 @@ void rwSettings(bool writing)
// known dbs and active (searched) ones. // known dbs and active (searched) ones.
// When starting up, we also add from the RECOLL_EXTRA_DBS environment // When starting up, we also add from the RECOLL_EXTRA_DBS environment
// variable. // variable.
// This are stored inside the dynamic configuration file (aka: history), // These are stored inside the dynamic configuration file (aka: history),
// as they are likely to depend on RECOLL_CONFDIR. // as they are likely to depend on RECOLL_CONFDIR.
if (writing) { if (writing) {
g_dynconf->eraseAll(allEdbsSk); g_dynconf->eraseAll(allEdbsSk);
@ -330,12 +336,11 @@ void rwSettings(bool writing)
const char *cp; const char *cp;
if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) { if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) {
vector<string> dbl; vector<string> dbl;
stringToTokens(cp, dbl, ":"); stringToTokens(cp, dbl, dirlistsep);
for (const auto& path : dbl) { for (const auto& path : dbl) {
string dbdir = path_canon(path); string dbdir = path_canon(path);
path_catslash(dbdir); path_catslash(dbdir);
if (std::find(prefs.allExtraDbs.begin(), if (std::find(prefs.allExtraDbs.begin(), prefs.allExtraDbs.end(), dbdir) !=
prefs.allExtraDbs.end(), dbdir) !=
prefs.allExtraDbs.end()) prefs.allExtraDbs.end())
continue; continue;
bool stripped; bool stripped;
@ -344,14 +349,12 @@ void rwSettings(bool writing)
continue; continue;
} }
if (stripped != o_index_stripchars) { if (stripped != o_index_stripchars) {
LOGERR("Incompatible character stripping: [" << dbdir << LOGERR("Incompatible character stripping: [" << dbdir << "]\n");
"]\n");
continue; continue;
} }
prefs.allExtraDbs.push_back(dbdir); prefs.allExtraDbs.push_back(dbdir);
} }
} }
// Get the remembered "active external indexes": // Get the remembered "active external indexes":
prefs.activeExtraDbs = g_dynconf->getStringEntries<vector>(actEdbsSk); prefs.activeExtraDbs = g_dynconf->getStringEntries<vector>(actEdbsSk);
@ -375,19 +378,17 @@ void rwSettings(bool writing)
const char *cp4Act; const char *cp4Act;
if ((cp4Act = getenv("RECOLL_ACTIVE_EXTRA_DBS")) != 0) { if ((cp4Act = getenv("RECOLL_ACTIVE_EXTRA_DBS")) != 0) {
vector<string> dbl; vector<string> dbl;
stringToTokens(cp4Act, dbl, ":"); stringToTokens(cp4Act, dbl, dirlistsep);
for (const auto& path : dbl) { for (const auto& path : dbl) {
string dbdir = path_canon(path); string dbdir = path_canon(path);
path_catslash(dbdir); path_catslash(dbdir);
if (std::find(prefs.activeExtraDbs.begin(), if (std::find(prefs.activeExtraDbs.begin(), prefs.activeExtraDbs.end(), dbdir) !=
prefs.activeExtraDbs.end(), dbdir) !=
prefs.activeExtraDbs.end()) prefs.activeExtraDbs.end())
continue; continue;
bool strpd; bool strpd;
if (!Rcl::Db::testDbDir(dbdir, &strpd) || if (!Rcl::Db::testDbDir(dbdir, &strpd) ||
strpd != o_index_stripchars) { strpd != o_index_stripchars) {
LOGERR("Not a Xapian dir or diff. char stripping: [" << LOGERR("Not a Xapian dir or diff. char stripping: [" << dbdir << "]\n");
dbdir << "]\n");
continue; continue;
} }
prefs.activeExtraDbs.push_back(dbdir); prefs.activeExtraDbs.push_back(dbdir);