From cb5a93ff492fca86b79cadbb3b4f6538d2750708 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Tue, 27 Oct 2009 17:27:37 +0100
Subject: [PATCH] Fix "Add New" using the wrong directory for cmake projects

---
 src/plugins/cmakeprojectmanager/cmakeproject.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index acf75f5c61d..770ee8411fa 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -497,11 +497,13 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
     QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
     QStringList parts = relativePath.split("/", QString::SkipEmptyParts);
     ProjectExplorer::FolderNode *parent = rootNode;
+    QString path = QFileInfo(rootNode->path()).path();
     foreach (const QString &part, parts) {
+        path += "/" + part;
         // Find folder in subFolders
         bool found = false;
         foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
-            if (QFileInfo(folder->path()).fileName() == part) {
+            if (folder->path() == path) {
                 // yeah found something :)
                 parent = folder;
                 found = true;
@@ -510,7 +512,8 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
         }
         if (!found) {
             // No FolderNode yet, so create it
-            ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(part);
+            ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(path);
+            tmp->setFolderName(part);
             rootNode->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << tmp, parent);
             parent = tmp;
         }
-- 
GitLab