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>
This commit is contained in:
Vikas Pachdha
2020-08-12 11:56:09 +02:00
parent 81b4e63bda
commit 48bfe882e0
2 changed files with 10 additions and 3 deletions

View File

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

View File

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