Commit 39e2c013 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

ProjectExplorer: Handle root directory when creating folders

Handle root directory properly (a empty filePath in the base node) when
creating folder nodes in the project tree.

Change-Id: Iad761b94ee210406ed5ab9ceb2d00ce25db90046
Reviewed-by: Tim Jenssen's avatarTim Jenssen <>
parent f9e93577
......@@ -383,12 +383,17 @@ FolderNode *FolderNode::folderNode(const Utils::FileName &directory) const
FolderNode *FolderNode::recursiveFindOrCreateFolderNode(const QString &directory)
Utils::FileName path = filePath();
QDir parentDir(path.toString());
QString relativePath = parentDir.relativeFilePath(directory);
if (relativePath == ".")
QString workPath;
if (path.isEmpty() || path.toFileInfo().isRoot()) {
workPath = directory;
} else {
QDir parentDir(path.toString());
workPath = parentDir.relativeFilePath(directory);
if (workPath == ".")
const QStringList parts = workPath.split('/', QString::SkipEmptyParts);
QStringList parts = relativePath.split('/', QString::SkipEmptyParts);
ProjectExplorer::FolderNode *parent = this;
foreach (const QString &part, parts) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment