diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 4195fbee339679d72609e8c9ecae230c8fcccb94..866a3d05c9460e2ced1d283ba86ea0707f470edf 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -163,7 +163,8 @@ QFileInfo CppToolsPlugin::findFile(const QDir &dir, const QString &name, if (debug) qDebug() << Q_FUNC_INFO << dir << name; - if (project) { + QFileInfo fileInSameDir(dir, name); + if (project && !fileInSameDir.isFile()) { QString pattern = QString(1, QLatin1Char('/')); pattern += name; const QStringList projectFiles = project->files(ProjectExplorer::Project::AllFiles); @@ -173,7 +174,7 @@ QFileInfo CppToolsPlugin::findFile(const QDir &dir, const QString &name, return QFileInfo(*it); return QFileInfo(); } - return QFileInfo(dir, name); + return fileInSameDir; } // Figure out file type