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:
@@ -38,7 +38,6 @@
|
||||
#include "ScopedFunctor.h"
|
||||
#include "utility.h"
|
||||
#include "utilityApp.h"
|
||||
#include "utilityCxx.h"
|
||||
#include "utilityFile.h"
|
||||
#include "utilityPathDetection.h"
|
||||
#include "utilityString.h"
|
||||
@@ -1029,46 +1028,38 @@ void QtProjectWizzardContentPathsHeaderSearchGlobal::load()
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::save()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setHeaderSearchPaths(m_list->getPathsAsDisplayed());
|
||||
std::vector<FilePath> paths;
|
||||
for (const FilePath& headerPath : m_list->getPathsAsDisplayed())
|
||||
{
|
||||
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath())
|
||||
{
|
||||
paths.push_back(headerPath);
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSettings::getInstance()->setHeaderSearchPaths(paths);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentPathsHeaderSearchGlobal::check()
|
||||
{
|
||||
bool hasCompilerHeaderPath = false;
|
||||
if (utility::getOsType() == OS_WINDOWS)
|
||||
{
|
||||
return QtProjectWizzardContentPaths::check();
|
||||
}
|
||||
|
||||
bool hasOtherCompilerConfig = false;
|
||||
for (const FilePath& headerPath : m_list->getPathsAsDisplayed())
|
||||
{
|
||||
if (headerPath == ResourcePaths::getCxxCompilerHeaderPath())
|
||||
{
|
||||
hasCompilerHeaderPath = true;
|
||||
}
|
||||
else if (headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
|
||||
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath() &&
|
||||
headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
|
||||
{
|
||||
hasOtherCompilerConfig = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasCompilerHeaderPath)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Compiler Header Path missing");
|
||||
msgBox.setInformativeText("Your Global Include Paths do not contain the path to the compiler headers of "
|
||||
"Sourcetrail's C/C++ indexer. This can cause a lot of errors during indexing. Do you want to add the "
|
||||
"path to the list?");
|
||||
msgBox.addButton("Add", QMessageBox::ButtonRole::YesRole);
|
||||
msgBox.addButton("Skip", QMessageBox::ButtonRole::NoRole);
|
||||
msgBox.setIcon(QMessageBox::Icon::Question);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == 0) // QMessageBox::Yes
|
||||
{
|
||||
m_list->addPaths({ ResourcePaths::getCxxCompilerHeaderPath() }, true);
|
||||
hasCompilerHeaderPath = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (utility::getOsType() != OS_WINDOWS && hasOtherCompilerConfig && hasCompilerHeaderPath)
|
||||
if (hasOtherCompilerConfig)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Multiple Compiler Headers");
|
||||
@@ -1086,11 +1077,12 @@ bool QtProjectWizzardContentPathsHeaderSearchGlobal::check()
|
||||
std::vector<FilePath> paths;
|
||||
for (const FilePath& headerPath : m_list->getPathsAsDisplayed())
|
||||
{
|
||||
if (headerPath == ResourcePaths::getCxxCompilerHeaderPath() ||
|
||||
!headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
|
||||
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath() &&
|
||||
headerPath.getCanonical().getConcatenated(L"/stdarg.h").exists())
|
||||
{
|
||||
paths.push_back(headerPath);
|
||||
continue;
|
||||
}
|
||||
paths.push_back(headerPath);
|
||||
}
|
||||
setPaths(paths);
|
||||
}
|
||||
@@ -1101,27 +1093,22 @@ bool QtProjectWizzardContentPathsHeaderSearchGlobal::check()
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::detectedPaths(const std::vector<FilePath>& paths)
|
||||
{
|
||||
setPaths(paths);
|
||||
std::vector<FilePath> headerPaths;
|
||||
for (const FilePath& headerPath : paths)
|
||||
{
|
||||
if (headerPath != ResourcePaths::getCxxCompilerHeaderPath())
|
||||
{
|
||||
headerPaths.push_back(headerPath);
|
||||
}
|
||||
}
|
||||
setPaths(headerPaths);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPathsHeaderSearchGlobal::setPaths(const std::vector<FilePath>& paths)
|
||||
{
|
||||
m_list->setPaths({});
|
||||
|
||||
std::vector<FilePath> nonCxxCompilerHeaderPaths;
|
||||
for (const FilePath& headerPath : paths)
|
||||
{
|
||||
if (headerPath == ResourcePaths::getCxxCompilerHeaderPath())
|
||||
{
|
||||
m_list->addPaths({ headerPath }, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
nonCxxCompilerHeaderPaths.push_back(headerPath);
|
||||
}
|
||||
}
|
||||
|
||||
m_list->addPaths(nonCxxCompilerHeaderPaths);
|
||||
m_list->addPaths({ ResourcePaths::getCxxCompilerHeaderPath() }, true);
|
||||
m_list->addPaths(paths);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user