diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index f98bbfb0e9f..42486a72fff 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -190,6 +190,17 @@ QString FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const } } + // find (solely by filename) in project files + const QString fileName = QFileInfo(originalPath).fileName(); + foreach (const QString &f, m_projectFiles) { + if (QFileInfo(f).fileName() == fileName) { + m_cache.insert(originalPath, f); + if (success) + *success = true; + return f; + } + } + // check if absolute path is found in sysroot if (!m_sysroot.isEmpty()) { const QString sysrootPath = m_sysroot + originalPath; @@ -201,17 +212,6 @@ QString FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const } } - // finally, find solely by filename in project files - const QString fileName = QFileInfo(originalPath).fileName(); - foreach (const QString &f, m_projectFiles) { - if (QFileInfo(f).fileName() == fileName) { - m_cache.insert(originalPath, f); - if (success) - *success = true; - return f; - } - } - if (success) *success = false;