From 92c42ef9ff6c85053417b206792f9fce4774a198 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 13 Jan 2022 09:55:34 +0100 Subject: [PATCH] QmlDesigner: Fix content folder location when adding assets Task-number: QDS-5953 Change-Id: Iaa566d2ad9d528f27288c54c1cf0ff97a850dec6 Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Miikka Heikkinen --- .../components/componentcore/modelnodeoperations.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index de36baff61a..1daf04e3c51 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1044,15 +1044,16 @@ static QString getAssetDefaultDirectory(const QString &assetDir, const QString & { QString adjustedDefaultDirectory = defaultDirectory; - Utils::FilePath assetPath = projectFilePath(); - if (assetPath.pathAppended("content").exists()) - assetPath= assetPath.pathAppended("content"); + Utils::FilePath contentPath = projectFilePath(); - assetPath = assetPath.pathAppended(assetDir); + if (contentPath.pathAppended("content").exists()) + contentPath = contentPath.pathAppended("content"); + + Utils::FilePath assetPath = contentPath.pathAppended(assetDir); if (!assetPath.exists()) { // Create the default asset type directory if it doesn't exist - QDir dir(projectFilePath().toString()); + QDir dir(contentPath.toString()); dir.mkpath(assetDir); }