From 5e0338d6222e7809a0023f55eba55714687c30de Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 10 Oct 2016 16:35:29 +0200 Subject: [PATCH 1/2] Fixed: Wrong modification dates of files uncompressed from 7z and ZIP archives --HG-- branch : develop --- .../ryzom_installer/src/filesextractor.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index 17319bf0e..28b04f82b 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -291,6 +291,26 @@ bool CFilesExtractor::exec() return false; } +static uint32 convertWindowsFileTimeToUnixTimestamp(const CNtfsFileTime &nt) +{ + // first, convert it into second since jan1, 1601 + uint64 t = nt.Low | (uint64(nt.High) << 32); + + // offset to convert Windows file times to UNIX timestamp + uint64 offset = UINT64_CONSTANT(116444736000000000); + + // adjust time base to unix epoch base + t -= offset; + + // convert the resulting time into seconds + t /= 10; // microsec + t /= 1000; // millisec + t /= 1000; // sec + + // return the resulting time + return uint32(t); +} + bool CFilesExtractor::extract7z() { Q7zFile inFile(m_sourceFile); @@ -432,8 +452,22 @@ bool CFilesExtractor::extract7z() if (m_listener) m_listener->operationProgress(totalUncompressed, filename); + // set attrinbutes if (SzBitWithVals_Check(&db.Attribs, i)) + { Set7zFileAttrib(destPath, db.Attribs.Vals[i]); + } + + // set modification time + if (SzBitWithVals_Check(&db.MTime, i)) + { + char buffer[1024]; + + if (!NLMISC::CFile::setFileModificationDate(qToUtf8(destPath), convertWindowsFileTimeToUnixTimestamp(db.MTime.Vals[i]))) + { + qDebug() << "Unable to change date of " << destPath; + } + } } IAlloc_Free(&allocImp, outBuffer); @@ -550,6 +584,12 @@ bool CFilesExtractor::extractZip() f.setPermissions(fi.permissions); f.close(); + // set the right modification date + if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t())) + { + qDebug() << "Unable to change date of " << absPath; + } + if (m_listener) m_listener->operationProgress(currentSize, QFileInfo(absPath).fileName()); } } From f279e5f726a221708f999b74bba0f53b9d0f9cdf Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 10 Oct 2016 16:35:45 +0200 Subject: [PATCH 2/2] Fixed: Missing .sh file in QRC --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/res/resources.qrc | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/tools/client/ryzom_installer/res/resources.qrc b/code/ryzom/tools/client/ryzom_installer/res/resources.qrc index 6336b61e1..8e8a774a8 100644 --- a/code/ryzom/tools/client/ryzom_installer/res/resources.qrc +++ b/code/ryzom/tools/client/ryzom_installer/res/resources.qrc @@ -12,5 +12,6 @@ ryzom_installer.ini Info.plist PkgInfo + shortcut.sh