ui: clean indexed header path selection
* for CDB projects the selection dialog for the indexed header paths now discards all paths that are subdirectories of other entries
This commit is contained in:
@@ -166,8 +166,7 @@ std::vector<T> utility::unique(const std::vector<T>& a)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<T> r;
|
||||
r.reserve(i);
|
||||
std::vector<T> r(i, T());
|
||||
for (const std::pair<T, size_t>& p : unique)
|
||||
{
|
||||
r[p.second] = p.first;
|
||||
|
||||
@@ -292,7 +292,24 @@ void QtProjectWizzardContentPathsCDBHeader::buttonClicked()
|
||||
utility::CompilationDatabase cdb(cdbPath.str());
|
||||
|
||||
std::vector<FilePath> sourcePaths = m_settings->getSourcePaths();
|
||||
std::vector<FilePath> cdbHeaderPaths = utility::unique(utility::concat(sourcePaths, cdb.getAllHeaderPaths()));
|
||||
|
||||
std::vector<FilePath> cdbHeaderPaths;
|
||||
for (const FilePath& path: utility::unique(utility::concat(sourcePaths, cdb.getAllHeaderPaths())))
|
||||
{
|
||||
bool addPath = true;
|
||||
for (const FilePath& cdbHeaderPath: cdbHeaderPaths)
|
||||
{
|
||||
if (cdbHeaderPath.contains(path))
|
||||
{
|
||||
addPath = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (addPath)
|
||||
{
|
||||
cdbHeaderPaths.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
dynamic_cast<QtSelectPathsDialog*>(m_filesDialog.get())->setPathsList(cdbHeaderPaths, sourcePaths);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user