diff options
author | Vikas Pachdha <vikas.pachdha@qt.io> | 2020-08-12 11:56:09 +0200 |
---|---|---|
committer | Vikas Pachdha <vikas.pachdha@qt.io> | 2020-08-31 09:30:09 +0000 |
commit | 48bfe882e030f1037da943f814135e0898f33eaf (patch) | |
tree | d56bb8f30be7bdadf2f4c87d182fce84f90093ec /src/plugins | |
parent | 81b4e63bdab440bdde579ba35dec435919be1190 (diff) |
AssetExport: Export the metadata oustside the project directory
Name the metadata file after the project being exported
Task-number: QDS-2612
Change-Id: Ia073f6969708f2ed89552dfc7a38305563e2bef2
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp | 7 | ||||
-rw-r--r-- | src/plugins/qmldesigner/assetexporterplugin/assetexporterplugin.cpp | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp b/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp index 1ea1e09e92..b975c228e6 100644 --- a/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp +++ b/src/plugins/qmldesigner/assetexporterplugin/assetexporter.cpp @@ -32,6 +32,8 @@ #include "utils/qtcassert.h" #include "utils/runextensions.h" #include "variantproperty.h" +#include "projectexplorer/session.h" +#include "projectexplorer/project.h" #include <QCryptographicHash> #include <QDir> @@ -239,7 +241,10 @@ void AssetExporter::writeMetadata() const return; } - Utils::FilePath metadataPath = m_exportPath.pathAppended(m_exportPath.fileName() + ".metadata"); + auto const startupProject = ProjectExplorer::SessionManager::startupProject(); + QTC_ASSERT(startupProject, return); + const QString projectName = startupProject->displayName(); + Utils::FilePath metadataPath = m_exportPath.pathAppended(projectName + ".metadata"); ExportNotification::addInfo(tr("Writing metadata to file %1."). arg(metadataPath.toUserOutput())); makeParentPath(metadataPath); diff --git a/src/plugins/qmldesigner/assetexporterplugin/assetexporterplugin.cpp b/src/plugins/qmldesigner/assetexporterplugin/assetexporterplugin.cpp index e45e48ca0d..5c42411443 100644 --- a/src/plugins/qmldesigner/assetexporterplugin/assetexporterplugin.cpp +++ b/src/plugins/qmldesigner/assetexporterplugin/assetexporterplugin.cpp @@ -95,8 +95,10 @@ void AssetExporterPlugin::onExport() return; FilePathModel model(startupProject); - QString exportDirName = startupProject->displayName() + "_export"; - auto exportDir = startupProject->projectFilePath().parentDir().pathAppended(exportDirName); + auto exportDir = startupProject->projectFilePath().parentDir(); + if (!exportDir.parentDir().isEmpty()) + exportDir = exportDir.parentDir(); + exportDir = exportDir.pathAppended(startupProject->displayName() + "_export"); AssetExporter assetExporter(m_view, startupProject); AssetExportDialog assetExporterDialog(exportDir, assetExporter, model); assetExporterDialog.exec(); |