Commit 123ef3db authored by con's avatar con
Browse files

Fixes: - Switch Header/Source sometimes uses wrong file

Task:     - 237723
Details:  - Look in the same directory first, then go through project's
files.
parent 92bbbc95
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment