From 19b7468bb69428e074eb141b302e6236decf2471 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Aug 2011 10:34:01 +0300 Subject: [PATCH] GUI: Fix order of project/global include directories. Per project include directories must be added to the list before the global include directories. Include directories are searched in listed order. So placing per project include directories first we ensure per project include file is found instead of the global include file if same file exist in both. --- gui/mainwindow.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 08ba05cfc..6236937bc 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -447,13 +447,6 @@ Settings MainWindow::GetCppcheckSettings() { Settings result; - QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString(); - if (!globalIncludes.isEmpty()) - { - QStringList includes = globalIncludes.split(";"); - AddIncludeDirs(includes, result); - } - // If project file loaded, read settings from it if (mProject) { @@ -471,6 +464,16 @@ Settings MainWindow::GetCppcheckSettings() } } + // Include directories (and files) are searched in listed order. + // Global include directories must be added AFTER the per project include + // directories so per project include directories can override global ones. + const QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString(); + if (!globalIncludes.isEmpty()) + { + QStringList includes = globalIncludes.split(";"); + AddIncludeDirs(includes, result); + } + result.addEnabled("style"); result.addEnabled("information"); result.addEnabled("missingInclude");