From 3d56b8b54a369d50a9544c0f594fa75d7d18bac6 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 17 Feb 2022 21:39:54 +0100 Subject: [PATCH] QmlDesigner: Fix creation date issue on macOS On macOS the creation date was not according to the date/time when the example was unzipped it was rather the date/time when the example folder was zipped. By removing the already existing folder and create it again to hold the content of the zip archive this issue should b circumvented. Task-number: QDS-6288 Change-Id: Icf18c4fcddcacf69feeca536f6d0e81f4c126afe Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- src/plugins/studiowelcome/examplecheckout.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/studiowelcome/examplecheckout.cpp b/src/plugins/studiowelcome/examplecheckout.cpp index 9cbc57cd827..06d37a39317 100644 --- a/src/plugins/studiowelcome/examplecheckout.cpp +++ b/src/plugins/studiowelcome/examplecheckout.cpp @@ -368,12 +368,21 @@ QString FileExtractor::sourceFile() const void FileExtractor::extract() { + const QString targetFolder = m_targetPath.toString() + "/" + m_archiveName; + + // If the target directory already exists, remove it and its content + QDir targetDir(targetFolder); + if (targetDir.exists()) + targetDir.removeRecursively(); + + // Create a new directory to generate a proper creation date + targetDir.mkdir(targetFolder); + Utils::Archive *archive = Utils::Archive::unarchive(m_sourceFile, m_targetPath); archive->setParent(this); QTC_ASSERT(archive, return ); m_timer.start(); - const QString targetFolder = m_targetPath.toString() + "/" + m_archiveName; qint64 bytesBefore = QStorageInfo(m_targetPath.toFileInfo().dir()).bytesAvailable(); qint64 compressedSize = QFileInfo(m_sourceFile.toString()).size();