From 8b4656ede56a2d4f6adb2aa6b4a78ce3a7823832 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 1 Nov 2019 09:06:37 +0100 Subject: [PATCH] rclconfig: more uniform generation and improved readability of error message --- src/common/rclconfig.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 65d03f1b..805ba080 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -310,16 +310,19 @@ RclConfig::RclConfig(const string *argcnf) m_cdirs.push_back(path_cat(m_datadir, "examples")); string cnferrloc; - for (vector::const_iterator it = m_cdirs.begin(); - it != m_cdirs.end(); it++) { - if (it != m_cdirs.begin()) - cnferrloc += string(" or "); - cnferrloc += *it; + for (const auto& dir : m_cdirs) { + cnferrloc += "[" + dir + "] or "; + } + if (cnferrloc.size() > 4) { + cnferrloc.erase(cnferrloc.size()-4); } // Read and process "recoll.conf" - if (!updateMainConfig()) + if (!updateMainConfig()) { + m_reason = string("No/bad main configuration file in: ") + cnferrloc; return; + } + // Other files mimemap = new ConfStack("mimemap", m_cdirs, true); if (mimemap == 0 || !mimemap->ok()) { @@ -382,9 +385,6 @@ bool RclConfig::updateMainConfig() if (newconf == 0 || !newconf->ok()) { if (m_conf) return false; - string where; - stringsToString(m_cdirs, where); - m_reason = string("No/bad main configuration file in: ") + where; m_ok = false; initParamStale(0, 0); return false;