shared: Indexer: Exclude 'excludedPaths' settings already at DirScanner, not only FileSaver

This commit is contained in:
Albert S. 2022-06-13 21:49:04 +02:00
parent c82cf03814
commit b108cb7151

View File

@ -19,7 +19,21 @@ void Indexer::beginIndexing()
QVector<QString> dirs; QVector<QString> dirs;
WildcardMatcher wildcardMatcher; WildcardMatcher wildcardMatcher;
wildcardMatcher.setPatterns(this->ignorePattern);
QStringList ignoreList = this->ignorePattern;
for(QString &excludedPath : Common::excludedPaths())
{
QString pattern = excludedPath;
if(!pattern.endsWith("/"))
{
pattern += "/";
}
pattern += "*";
ignoreList.append(excludedPath);
}
ignoreList.append(this->ignorePattern);
wildcardMatcher.setPatterns(ignoreList);
for(QString &path : this->pathsToScan) for(QString &path : this->pathsToScan)
{ {
if(wildcardMatcher.match(path)) if(wildcardMatcher.match(path))
@ -40,7 +54,7 @@ void Indexer::beginIndexing()
if(!dirs.empty()) if(!dirs.empty())
{ {
this->dirScanner->setPaths(dirs); this->dirScanner->setPaths(dirs);
this->dirScanner->setIgnorePatterns(this->ignorePattern); this->dirScanner->setIgnorePatterns(ignoreList);
this->dirScanner->scan(); this->dirScanner->scan();
} }