ui: implemented prefilling indexed header paths for compilation database projects
* fixed header path detection in CompilationDatabase class
This commit is contained in:
@@ -508,6 +508,8 @@ add_files(
|
||||
utility/UserPaths.h
|
||||
utility/utility.cpp
|
||||
utility/utility.h
|
||||
utility/utilityFile.cpp
|
||||
utility/utilityFile.h
|
||||
utility/utilityLibrary.h
|
||||
utility/utilityString.cpp
|
||||
utility/utilityString.h
|
||||
|
||||
@@ -124,7 +124,7 @@ std::string ProjectSettings::getProjectName() const
|
||||
return getFilePath().withoutExtension().fileName();
|
||||
}
|
||||
|
||||
FilePath ProjectSettings::getProjectFileLocation() const
|
||||
FilePath ProjectSettings::getProjectDirectoryPath() const
|
||||
{
|
||||
return getFilePath().parentDirectory();
|
||||
}
|
||||
@@ -204,7 +204,7 @@ std::vector<FilePath> ProjectSettings::makePathsExpandedAndAbsolute(const std::v
|
||||
std::vector<FilePath> p = expandPaths(paths);
|
||||
|
||||
std::vector<FilePath> absPaths;
|
||||
FilePath basePath = getProjectFileLocation();
|
||||
FilePath basePath = getProjectDirectoryPath();
|
||||
for (const FilePath& path : p)
|
||||
{
|
||||
if (path.isAbsolute())
|
||||
@@ -229,7 +229,7 @@ FilePath ProjectSettings::makePathExpandedAndAbsolute(const FilePath& path) cons
|
||||
return p;
|
||||
}
|
||||
|
||||
return getProjectFileLocation().concat(p).canonical();
|
||||
return getProjectDirectoryPath().concat(p).canonical();
|
||||
}
|
||||
|
||||
SettingsMigrator ProjectSettings::getMigrations() const
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
void setProjectFilePath(std::string projectName, const FilePath& projectFileLocation);
|
||||
|
||||
std::string getProjectName() const;
|
||||
FilePath getProjectFileLocation() const;
|
||||
FilePath getProjectDirectoryPath() const;
|
||||
|
||||
std::string getDescription() const;
|
||||
|
||||
|
||||
@@ -80,9 +80,9 @@ void SourceGroupSettings::setName(const std::string& name)
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettings::getProjectFileLocation() const
|
||||
FilePath SourceGroupSettings::getProjectDirectoryPath() const
|
||||
{
|
||||
return m_projectSettings->getProjectFileLocation();
|
||||
return m_projectSettings->getProjectDirectoryPath();
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettings::makePathExpandedAndAbsolute(const FilePath& path) const
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
std::string getName() const;
|
||||
void setName(const std::string& name);
|
||||
|
||||
FilePath getProjectFileLocation() const;
|
||||
FilePath getProjectDirectoryPath() const;
|
||||
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
||||
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "utility/utilityFile.h"
|
||||
|
||||
std::vector<FilePath> utility::getTopLevelPaths(const std::vector<FilePath>& paths)
|
||||
{
|
||||
std::vector<FilePath> topLevelPaths;
|
||||
for (const FilePath& path : paths)
|
||||
{
|
||||
bool addPath = true;
|
||||
for (size_t i = 0; i < topLevelPaths.size(); i++)
|
||||
{
|
||||
if (topLevelPaths[i].contains(path))
|
||||
{
|
||||
addPath = false;
|
||||
break;
|
||||
}
|
||||
else if(path.contains(topLevelPaths[i]))
|
||||
{
|
||||
topLevelPaths.erase(topLevelPaths.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (addPath)
|
||||
{
|
||||
topLevelPaths.push_back(path);
|
||||
}
|
||||
}
|
||||
return topLevelPaths;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef UTILITY_FILE_H
|
||||
#define UTILITY_FILE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
namespace utility
|
||||
{
|
||||
std::vector<FilePath> getTopLevelPaths(const std::vector<FilePath>& paths);
|
||||
}
|
||||
|
||||
#endif // UTILITY_FILE_H
|
||||
Reference in New Issue
Block a user