rclconfig: more uniform generation and improved readability of error message

This commit is contained in:
Jean-Francois Dockes 2019-11-01 09:06:37 +01:00
parent 375806560b
commit 8b4656ede5

View File

@ -310,16 +310,19 @@ RclConfig::RclConfig(const string *argcnf)
m_cdirs.push_back(path_cat(m_datadir, "examples")); m_cdirs.push_back(path_cat(m_datadir, "examples"));
string cnferrloc; string cnferrloc;
for (vector<string>::const_iterator it = m_cdirs.begin(); for (const auto& dir : m_cdirs) {
it != m_cdirs.end(); it++) { cnferrloc += "[" + dir + "] or ";
if (it != m_cdirs.begin()) }
cnferrloc += string(" or "); if (cnferrloc.size() > 4) {
cnferrloc += *it; cnferrloc.erase(cnferrloc.size()-4);
} }
// Read and process "recoll.conf" // Read and process "recoll.conf"
if (!updateMainConfig()) if (!updateMainConfig()) {
m_reason = string("No/bad main configuration file in: ") + cnferrloc;
return; return;
}
// Other files // Other files
mimemap = new ConfStack<ConfTree>("mimemap", m_cdirs, true); mimemap = new ConfStack<ConfTree>("mimemap", m_cdirs, true);
if (mimemap == 0 || !mimemap->ok()) { if (mimemap == 0 || !mimemap->ok()) {
@ -382,9 +385,6 @@ bool RclConfig::updateMainConfig()
if (newconf == 0 || !newconf->ok()) { if (newconf == 0 || !newconf->ok()) {
if (m_conf) if (m_conf)
return false; return false;
string where;
stringsToString(m_cdirs, where);
m_reason = string("No/bad main configuration file in: ") + where;
m_ok = false; m_ok = false;
initParamStale(0, 0); initParamStale(0, 0);
return false; return false;