forked from qt-creator/qt-creator
Fixes: - Switch Header/Source sometimes uses wrong file
Task: - 237723 Details: - Look in the same directory first, then go through project's files.
This commit is contained in:
@@ -163,7 +163,8 @@ QFileInfo CppToolsPlugin::findFile(const QDir &dir, const QString &name,
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << Q_FUNC_INFO << dir << name;
|
qDebug() << Q_FUNC_INFO << dir << name;
|
||||||
|
|
||||||
if (project) {
|
QFileInfo fileInSameDir(dir, name);
|
||||||
|
if (project && !fileInSameDir.isFile()) {
|
||||||
QString pattern = QString(1, QLatin1Char('/'));
|
QString pattern = QString(1, QLatin1Char('/'));
|
||||||
pattern += name;
|
pattern += name;
|
||||||
const QStringList projectFiles = project->files(ProjectExplorer::Project::AllFiles);
|
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(*it);
|
||||||
return QFileInfo();
|
return QFileInfo();
|
||||||
}
|
}
|
||||||
return QFileInfo(dir, name);
|
return fileInSameDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out file type
|
// Figure out file type
|
||||||
|
|||||||
Reference in New Issue
Block a user