forked from qt-creator/qt-creator
FileInProjectFinder: Do not overwrite result list in loop
Change-Id: Idadb7fcc43f816ea202b620472144392dd1e338e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -464,20 +464,20 @@ FileInProjectFinder::PathMappingNode::~PathMappingNode()
|
||||
|
||||
FileNameList FileInProjectFinder::QrcUrlFinder::find(const QUrl &fileUrl) const
|
||||
{
|
||||
FileNameList result;
|
||||
const auto fileIt = m_fileCache.constFind(fileUrl);
|
||||
if (fileIt != m_fileCache.cend())
|
||||
return fileIt.value();
|
||||
QStringList hits;
|
||||
for (const FileName &f : m_allQrcFiles) {
|
||||
QrcParser::Ptr &qrcParser = m_parserCache[f];
|
||||
if (!qrcParser)
|
||||
qrcParser = QrcParser::parseQrcFile(f.toString(), QString());
|
||||
if (!qrcParser->isValid())
|
||||
continue;
|
||||
QStringList hits;
|
||||
qrcParser->collectFilesAtPath(QrcParser::normalizedQrcFilePath(fileUrl.toString()), &hits);
|
||||
result = transform(hits, [](const QString &fp) { return FileName::fromString(fp); });
|
||||
}
|
||||
hits.removeDuplicates();
|
||||
const FileNameList result = transform(hits, &FileName::fromString);
|
||||
m_fileCache.insert(fileUrl, result);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user