QmlDesigner: Create imports directory before copying template files

Fixes: QDS-11946
Change-Id: I13f200c18d8b4775d6353ba994b83b8b72313e60
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Ali Kianian
2024-02-20 10:16:01 +02:00
parent f926cbaaca
commit 0f9782070a

View File

@@ -289,8 +289,13 @@ bool ensureDataStoreExists(bool &justCreated)
return false; return false;
} }
templatePath.copyFile(filePath); if (!filePath.parentDir().ensureWritableDir()) {
if (filePath.exists()) { qWarning() << Q_FUNC_INFO << __LINE__ << "Cannot create directory"
<< filePath.parentDir();
return false;
}
if (templatePath.copyFile(filePath)) {
justCreated = true; justCreated = true;
return true; return true;
} }