From 6ff93a6b36a9e998c1ce9d9c485124dcb0326749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 3 Jan 2014 21:59:50 +0100 Subject: [PATCH] CLI: Made the 'failed to load std.cfg' nicer and more informative. --- cli/cppcheckexecutor.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index b24e55751..9912518ed 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -162,8 +162,18 @@ int CppCheckExecutor::check(int argc, const char* const argv[]) if (!std || !posix) { const std::list callstack; - const std::string msg("Failed to load " + std::string(!std ? "std.cfg" : "posix.cfg") + ". Your Cppcheck installation is broken."); - ErrorLogger::ErrorMessage errmsg(callstack, Severity::information, msg, "failedToLoadCfg", false); + const std::string msg("Failed to load " + std::string(!std ? "std.cfg" : "posix.cfg") + ". Your Cppcheck installation is broken, please re-install."); +#ifdef CFGDIR + const std::string details("The Cppcheck binary was compiled with CFGDIR set to \"" + + std::string(CFGDIR) + "\" and will therefore search for " + "std.cfg in that path."); +#else + const std::string cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(argv[0])) + "cfg"); + const std::string details("The Cppcheck binary was compiled without CFGDIR set. Either the " + "std.cfg should be available in " + cfgfolder + " or the CFGDIR " + "should be configured."); +#endif + ErrorLogger::ErrorMessage errmsg(callstack, Severity::information, msg+" "+details, "failedToLoadCfg", false); reportErr(errmsg); return EXIT_FAILURE; }