logic: Don't store CxxCompilerHeaderPath in Global Include Paths

* show path in Global Include Paths preferences
* add to CXX indexer commands
* add migration to remove from app settings
This commit is contained in:
Eberhard Graether
2019-05-27 16:11:19 +02:00
parent 581b1894f2
commit b6a39a2d66
18 changed files with 1071 additions and 137 deletions
-2
View File
@@ -640,8 +640,6 @@ add_files(
utility/UserPaths.h
utility/utility.cpp
utility/utility.h
utility/utilityCxx.cpp
utility/utilityCxx.h
utility/utilityFile.cpp
utility/utilityFile.h
utility/utilityLibrary.h
+28 -18
View File
@@ -9,11 +9,10 @@
#include "Status.h"
#include "TimeStamp.h"
#include "utility.h"
#include "utilityCxx.h"
#include "UserPaths.h"
#include "Version.h"
const size_t ApplicationSettings::VERSION = 7;
const size_t ApplicationSettings::VERSION = 8;
std::shared_ptr<ApplicationSettings> ApplicationSettings::s_instance;
@@ -64,22 +63,6 @@ bool ApplicationSettings::load(const FilePath& filePath, bool readOnly)
}
}
));
migrator.addMigration(6, std::make_shared<SettingsMigrationLambda>(
[](const SettingsMigration* migration, Settings* settings)
{
std::vector<FilePath> cxxHeaderSearchPaths = migration->getValuesFromSettings(
settings, "indexing/cxx/header_search_paths/header_search_path", std::vector<FilePath>());
cxxHeaderSearchPaths = utility::replaceOrAddCxxCompilerHeaderPath(cxxHeaderSearchPaths);
migration->setValuesInSettings(settings, "indexing/cxx/header_search_paths/header_search_path", cxxHeaderSearchPaths);
if (cxxHeaderSearchPaths.size() == 1)
{
migration->setValueInSettings(settings, "indexing/cxx/has_prefilled_header_search_paths", false);
}
}
));
migrator.addMigration(7, std::make_shared<SettingsMigrationLambda>(
[](const SettingsMigration* migration, Settings* settings)
{
@@ -99,6 +82,33 @@ bool ApplicationSettings::load(const FilePath& filePath, bool readOnly)
migration->setValuesInSettings(settings, "user/recent_projects/recent_project", recentProjects);
}
));
migrator.addMigration(8, std::make_shared<SettingsMigrationLambda>(
[](const SettingsMigration* migration, Settings* settings)
{
std::vector<FilePath> cxxHeaderSearchPaths = migration->getValuesFromSettings(
settings, "indexing/cxx/header_search_paths/header_search_path", std::vector<FilePath>());
std::vector<FilePath> newCxxHeaderSearchPaths;
for (const FilePath& path : cxxHeaderSearchPaths)
{
if (path.getCanonical().getConcatenated(L"/stdarg.h").exists() &&
path.str().find("data/cxx/include") != std::string::npos)
{
continue;
}
newCxxHeaderSearchPaths.push_back(path);
}
migration->setValuesInSettings(
settings, "indexing/cxx/header_search_paths/header_search_path", newCxxHeaderSearchPaths);
if (newCxxHeaderSearchPaths.size() == 0)
{
migration->setValueInSettings(settings, "indexing/cxx/has_prefilled_header_search_paths", false);
}
}
));
bool migrated = migrator.migrate(this, ApplicationSettings::VERSION);
if (migrated)
{
-23
View File
@@ -1,23 +0,0 @@
#include "utilityCxx.h"
#include "ResourcePaths.h"
namespace utility
{
std::vector<FilePath> replaceOrAddCxxCompilerHeaderPath(const std::vector<FilePath>& headerSearchPaths)
{
std::vector<FilePath> newHeaderSearchPaths;
const FilePath cxxCompilerHeaderPath = ResourcePaths::getCxxCompilerHeaderPath();
for (const FilePath& path : headerSearchPaths)
{
if (path != cxxCompilerHeaderPath)
{
newHeaderSearchPaths.push_back(path);
}
}
newHeaderSearchPaths.push_back(cxxCompilerHeaderPath);
return newHeaderSearchPaths;
}
}
-13
View File
@@ -1,13 +0,0 @@
#ifndef UTILITY_CXX_H
#define UTILITY_CXX_H
#include <vector>
#include <utility/file/FilePath.h>
namespace utility
{
std::vector<FilePath> replaceOrAddCxxCompilerHeaderPath(const std::vector<FilePath>& headerSearchPaths);
}
#endif // UTILITY_CXX_H