logic: fixed exclude filters partly not working for CDB SourceGroup
* fixed logic for fetching all source file paths of CDB Sourcegroup to respect exclude filters * reused this logic in wizzard ui
This commit is contained in:
@@ -78,12 +78,33 @@ std::set<FilePath> SourceGroupCxxCdb::filterToContainedFilePaths(const std::set<
|
||||
|
||||
std::set<FilePath> SourceGroupCxxCdb::getAllSourceFilePaths() const
|
||||
{
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
|
||||
const std::vector<FilePathFilter> excludeFilters = m_settings->getExcludeFiltersExpandedAndAbsolute();
|
||||
const FilePath cdbPath = m_settings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
if (cdbPath.exists())
|
||||
|
||||
if (!cdbPath.empty() && cdbPath.exists())
|
||||
{
|
||||
return utility::toSet(IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath));
|
||||
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
|
||||
{
|
||||
bool excluded = false;
|
||||
for (const FilePathFilter& filter : excludeFilters)
|
||||
{
|
||||
if (filter.isMatching(path))
|
||||
{
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!excluded && path.exists())
|
||||
{
|
||||
sourceFilePaths.insert(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::set<FilePath>();
|
||||
|
||||
return sourceFilePaths;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "data/indexer/IndexerCommandCxxCdb.h"
|
||||
#include "project/SourceGroupCxxCdb.h"
|
||||
#include "qt/element/QtLocationPicker.h"
|
||||
#include "qt/view/QtDialogView.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
@@ -171,39 +172,14 @@ void QtProjectWizzardContentPathCDB::load()
|
||||
{
|
||||
m_picker->setText(QString::fromStdWString(cxxSettings->getCompilationDatabasePath().wstr()));
|
||||
|
||||
const std::vector<FilePathFilter> excludeFilters = cxxSettings->getExcludeFiltersExpandedAndAbsolute();
|
||||
const FilePath cdbPath = cxxSettings->getCompilationDatabasePathExpandedAndAbsolute();
|
||||
|
||||
if (!cdbPath.empty() && cdbPath.exists())
|
||||
for (FilePath path : SourceGroupCxxCdb(cxxSettings).getAllSourceFilePaths())
|
||||
{
|
||||
std::vector<FilePath> filePaths = IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
|
||||
|
||||
for (FilePath& path : filePaths)
|
||||
if (projectPath.exists())
|
||||
{
|
||||
{
|
||||
bool excluded = false;
|
||||
for (const FilePathFilter& filter : excludeFilters)
|
||||
{
|
||||
if (filter.isMatching(path))
|
||||
{
|
||||
excluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (excluded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectPath.exists())
|
||||
{
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
m_filePaths.push_back(path);
|
||||
path.makeRelativeTo(projectPath);
|
||||
}
|
||||
|
||||
m_filePaths.push_back(path);
|
||||
}
|
||||
|
||||
if (m_fileCountLabel)
|
||||
|
||||
Reference in New Issue
Block a user