From 52df4c8e562db27e11f61d33cca213c0a36b378e Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 11 Jun 2016 17:05:02 +0200 Subject: [PATCH] Fixed: Preserve files permissions after copying a file --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/filescopier.cpp | 7 +++++++ code/ryzom/tools/client/ryzom_installer/src/filescopier.h | 1 + 2 files changed, 8 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp index e0fadd0d2..43b54b3f9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp @@ -123,6 +123,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files) file.dst = dstPath; file.size = entry.size(); file.date = entry.lastModified().toTime_t(); + file.permissions = entry.permissions(); files << file; } @@ -141,6 +142,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files) file.dst = m_destinationDirectory + "/" + fileInfo.fileName(); file.size = fileInfo.size(); file.date = fileInfo.lastModified().toTime_t(); + file.permissions = fileInfo.permissions(); files << file; } @@ -187,6 +189,11 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files) return false; } + if (!QFile::setPermissions(file.dst, file.permissions)) + { + qDebug() << "Unable to change permissions of " << file.dst; + } + if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date)) { qDebug() << "Unable to change date of " << file.dst; diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescopier.h b/code/ryzom/tools/client/ryzom_installer/src/filescopier.h index 14dfe4054..8b505fb68 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescopier.h +++ b/code/ryzom/tools/client/ryzom_installer/src/filescopier.h @@ -49,6 +49,7 @@ protected: QString dst; qint64 size; uint date; + QFile::Permissions permissions; }; typedef QList FilesToCopy;