ui: implemented prefilling indexed header paths for compilation database projects
* fixed header path detection in CompilationDatabase class
This commit is contained in:
@@ -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