logic: Fixes and improvements for C/C++ compiler header path handling
* Always add compiler header path when prefilling on first start, regardless of successful detection * Show compiler header path in path list box on top and readonly * Prepend compiler header path on Windows in system header path compiler flags, append otherwise * Show warning when saving ApplicationSettings if compiler header path is not in global include paths * Show warning when saving ApplicationSettings if there is another path containing compiler headers
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "UserPaths.h"
|
||||
#include "Version.h"
|
||||
|
||||
const size_t ApplicationSettings::VERSION = 5;
|
||||
const size_t ApplicationSettings::VERSION = 6;
|
||||
|
||||
std::shared_ptr<ApplicationSettings> ApplicationSettings::s_instance;
|
||||
|
||||
@@ -78,11 +78,11 @@ bool ApplicationSettings::load(const FilePath& filePath, bool readOnly)
|
||||
}
|
||||
}
|
||||
));
|
||||
migrator.addMigration(5, std::make_shared<SettingsMigrationLambda>(
|
||||
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>());
|
||||
settings, "indexing/cxx/header_search_paths/header_search_path", std::vector<FilePath>());
|
||||
|
||||
cxxHeaderSearchPaths = utility::replaceOrAddCxxCompilerHeaderPath(cxxHeaderSearchPaths);
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ FilePath ResourcePaths::getJavaPath()
|
||||
|
||||
FilePath ResourcePaths::getCxxCompilerHeaderPath()
|
||||
{
|
||||
return AppPath::getAppPath().concatenate(L"data/cxx/include/");
|
||||
return AppPath::getAppPath().concatenate(L"data/cxx/include/").getCanonical();
|
||||
}
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
#include "utilityCxx.h"
|
||||
|
||||
#include "ResourcePaths.h"
|
||||
#include "utilityApp.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
std::vector<FilePath> replaceOrAddCxxCompilerHeaderPath(const std::vector<FilePath>& headerSearchPaths)
|
||||
{
|
||||
std::vector<FilePath> newHeaderSearchPaths;
|
||||
const FilePath cxxCompilerHeaderPath = ResourcePaths::getCxxCompilerHeaderPath();
|
||||
|
||||
if (utility::getOsType() == OS_WINDOWS)
|
||||
for (const FilePath& path : headerSearchPaths)
|
||||
{
|
||||
newHeaderSearchPaths = headerSearchPaths;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const FilePath& path : headerSearchPaths)
|
||||
if (path != cxxCompilerHeaderPath)
|
||||
{
|
||||
if (!path.getConcatenated(L"/stdarg.h").exists())
|
||||
{
|
||||
newHeaderSearchPaths.push_back(path);
|
||||
}
|
||||
newHeaderSearchPaths.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
newHeaderSearchPaths.push_back(ResourcePaths::getCxxCompilerHeaderPath().getCanonical());
|
||||
newHeaderSearchPaths.push_back(cxxCompilerHeaderPath);
|
||||
return newHeaderSearchPaths;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user