diff options
author | con <qtc-committer@nokia.com> | 2009-01-06 17:37:45 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-01-06 17:37:45 +0100 |
commit | 123ef3db8e8978b6801536aee1aa58daf40637bf (patch) | |
tree | 3b3b106e2fd1fa35d6ed62daf763a164e96ac63b | |
parent | 92bbbc95c8398b5f4afe1a45b54fb071c531dbcc (diff) | |
download | qt-creator-123ef3db8e8978b6801536aee1aa58daf40637bf.tar.gz |
Fixes: - Switch Header/Source sometimes uses wrong file
Task: - 237723
Details: - Look in the same directory first, then go through project's
files.
-rw-r--r-- | src/plugins/cpptools/cpptoolsplugin.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 4195fbee33..866a3d05c9 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 |