FileInProjectFinder: Use the cache also without project directory

As we add things to the cache, also without a project directory, there
is no reason why we wouldn't use the cache when looking them up.

Change-Id: I9f90cf7b88410513d2ebd0524e7d369fcb4db704
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Ulf Hermann
2018-07-25 15:27:24 +02:00
parent d35638df56
commit c98a390733

View File

@@ -159,10 +159,6 @@ QString FileInProjectFinder::findFileOrDirectory(const QString &originalPath, Fi
return originalPath;
}
if (!m_projectDir.isEmpty()) {
if (debug)
qDebug() << "FileInProjectFinder: checking project directory ...";
auto it = m_cache.find(originalPath);
if (it != m_cache.end()) {
if (debug)
@@ -175,6 +171,10 @@ QString FileInProjectFinder::findFileOrDirectory(const QString &originalPath, Fi
m_cache.erase(it);
}
if (!m_projectDir.isEmpty()) {
if (debug)
qDebug() << "FileInProjectFinder: checking project directory ...";
int prefixToIgnore = -1;
const QChar separator = QLatin1Char('/');
if (originalPath.startsWith(m_projectDir + separator)) {