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:
malte_langkabel
2017-07-24 17:08:43 +02:00
parent f2c7ecbbdf
commit 3a192c8089
2 changed files with 19 additions and 3 deletions
@@ -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);
}