From 19ce3e91bb8c723a3a9f9f94c1f7ad3aa2ce662e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 29 Sep 2021 09:50:29 +0200 Subject: [PATCH] Select project root when opening File System tree with project directory When choosing "Show in File System View" from the context menu of a project root node in Projects view, the File System view should show the project root directly, not the project directory as a child in the "Home" or "Computer" directories. Change-Id: Id2d5794cf747fd6b52289f6d08ef14ef18cd2dd4 Reviewed-by: Cristian Adam --- src/plugins/projectexplorer/foldernavigationwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index ee9a53cb90d..988d77eba57 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -654,7 +654,8 @@ int FolderNavigationWidget::bestRootForFile(const Utils::FilePath &filePath) int commonLength = 0; for (int i = 1; i < m_rootSelector->count(); ++i) { const auto root = m_rootSelector->itemData(i).value(); - if (filePath.isChildOf(root) && root.toString().size() > commonLength) { + if ((filePath == root || filePath.isChildOf(root)) + && root.toString().size() > commonLength) { index = i; commonLength = root.toString().size(); }