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:
con
2009-01-06 17:37:45 +01:00
parent 92bbbc95c8
commit 123ef3db8e

View File

@@ -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