QmlDesigner: Fix content folder location when adding assets

Task-number: QDS-5953
Change-Id: Iaa566d2ad9d528f27288c54c1cf0ff97a850dec6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-01-13 09:55:34 +01:00
parent 1463c5d09f
commit 92c42ef9ff

View File

@@ -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);
}