summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 0fe62c99b3..645cd4bcbf 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2344,14 +2344,16 @@ QString pathOrDirectoryFor(Node *node, bool dir)
FolderNode *folder = qobject_cast<FolderNode *>(node);
if (path.contains("#") && folder) {
// Virtual Folder case
- // We figure out a commonPath from the subfolders
- QStringList list;
- foreach (FolderNode *f, folder->subFolderNodes())
- list << f->path() + QLatin1Char('/');
- if (list.isEmpty())
- location = path.left(path.indexOf('#'));
- else
+ // If there are files directly below or no subfolders, take the folder path
+ if (!folder->fileNodes().isEmpty() || folder->subFolderNodes().isEmpty()) {
+ location = path.left(path.indexOf('#'));;
+ } else {
+ // Otherwise we figure out a commonPath from the subfolders
+ QStringList list;
+ foreach (FolderNode *f, folder->subFolderNodes())
+ list << f->path() + QLatin1Char('/');
location = Utils::commonPath(list);
+ }
} else {
QFileInfo fi(path);
if (dir) {