diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-28 22:32:45 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-28 22:32:45 +0100 |
commit | c816a26647ca0537709f0d15cdd550feea4de109 (patch) | |
tree | 53a8f0715a60c7f0e4ca64b85b3ccf8eb1016297 /logic/updater | |
parent | 595e4b697e911e2ed036446dd624dca77e234944 (diff) | |
download | MultiMC-c816a26647ca0537709f0d15cdd550feea4de109.tar MultiMC-c816a26647ca0537709f0d15cdd550feea4de109.tar.gz MultiMC-c816a26647ca0537709f0d15cdd550feea4de109.tar.lz MultiMC-c816a26647ca0537709f0d15cdd550feea4de109.tar.xz MultiMC-c816a26647ca0537709f0d15cdd550feea4de109.zip |
Set permissions for the updater binary after updating it.
Diffstat (limited to 'logic/updater')
-rw-r--r-- | logic/updater/DownloadUpdateTask.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp index 0b09ad2a..9282c4d8 100644 --- a/logic/updater/DownloadUpdateTask.cpp +++ b/logic/updater/DownloadUpdateTask.cpp @@ -412,6 +412,7 @@ DownloadUpdateTask::processFileLists(NetJob *job, if (isUpdater) { download->setProperty("finalPath", entry.path); + download->setProperty("finalPerms", entry.mode); connect(download.get(), &MD5EtagDownload::succeeded, this, &DownloadUpdateTask::directDeployFile); } } @@ -549,11 +550,16 @@ void DownloadUpdateTask::directDeployFile(const int index) { Md5EtagDownloadPtr download = std::dynamic_pointer_cast<MD5EtagDownload>(m_filesNetJob->operator[](index)); const QString finalPath = download->property("finalPath").toString(); + bool ok = true; + int finalMode = download->property("finalPerms").toInt(&ok); + if(!ok) + finalMode = 0755; QLOG_INFO() << "Replacing" << finalPath << "with" << download->m_output_file.fileName(); if (QFile::remove(finalPath)) { if (download->m_output_file.copy(finalPath)) { + QFile::setPermissions(finalPath, (QFileDevice::Permission) finalMode); return; } } |