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.
This commit is contained in:
unknown 2011-08-26 10:34:01 +03:00
parent 9539d22a1a
commit 19b7468bb6
1 changed files with 10 additions and 7 deletions

View File

@ -447,13 +447,6 @@ Settings MainWindow::GetCppcheckSettings()
{ {
Settings result; 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 project file loaded, read settings from it
if (mProject) 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("style");
result.addEnabled("information"); result.addEnabled("information");
result.addEnabled("missingInclude"); result.addEnabled("missingInclude");