aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/console
diff options
context:
space:
mode:
authorChristian Kandeler <[email protected]>2019-02-25 17:45:39 +0100
committerChristian Kandeler <[email protected]>2019-03-04 09:52:13 +0000
commitd0db212575909ca18244bdfc99b952dffcd0e902 (patch)
treef0fbfb40bc34b20a5f4539b6936c8854e78433ee /src/plugins/debugger/console
parentb0e125ac11b1ad80717366a1270412d6b6b1be41 (diff)
Resolve ambiguous results of searches for relative file paths
Qt Creator extracts file names from the output of external processes in various places, for instance from compilers during the build. It often happens that such file names are not absolute, so they cannot be directly opened in an editor when the user clicks on their representation in some widget. That's why they are processed by the FileInProjectFinder facility first. This patch enhances the FileInProjectFinder to be able to return more than one candidate for a relative file path, and allows the user to choose between these candidates where possible. This way, we won't open a random file anymore when a project contains more than one file with the same name. Fixes: QTCREATORBUG-13623 Change-Id: Id19c9eace3e6b3dbde89f6528e6d02b55872d747 Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/debugger/console')
-rw-r--r--src/plugins/debugger/console/consoleview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/debugger/console/consoleview.cpp b/src/plugins/debugger/console/consoleview.cpp
index 9969bfb0f5c..c6387cc9e05 100644
--- a/src/plugins/debugger/console/consoleview.cpp
+++ b/src/plugins/debugger/console/consoleview.cpp
@@ -218,7 +218,8 @@ void ConsoleView::onRowActivated(const QModelIndex &index)
if (!index.isValid())
return;
- const QFileInfo fi(m_finder.findFile(model()->data(index, ConsoleItem::FileRole).toString()));
+ const QFileInfo fi = m_finder.findFile(model()->data(index, ConsoleItem::FileRole).toString())
+ .first().toFileInfo();
if (fi.exists() && fi.isFile() && fi.isReadable()) {
Core::EditorManager::openEditorAt(fi.canonicalFilePath(),
model()->data(index, ConsoleItem::LineRole).toInt());