Set file permissions when downloading installer on Linux

This commit is contained in:
Mat Sutcliffe
2020-08-19 17:32:46 +01:00
parent ac02282ae7
commit d4b7b9dd40

View File

@@ -295,7 +295,7 @@ namespace BlackGui
for (const CRemoteFile &rf : executables)
{
const QString executable = CFileUtils::appendFilePaths(dir.absolutePath(), rf.getBaseName());
const QFile executableFile(executable);
QFile executableFile(executable);
if (!executableFile.exists()) { continue; }
QMessageBox::StandardButton reply = QMessageBox::question(this, "Start?", msg.arg(rf.getName()), QMessageBox::Yes | QMessageBox::No);
@@ -310,6 +310,12 @@ namespace BlackGui
return;
}
if (CBuildConfig::isRunningOnLinuxPlatform() && !executableFile.permissions().testFlag(QFile::ExeOwner))
{
executableFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner
| QFile::ReadGroup | QFile::ExeGroup | QFile::ReadOther | QFile::ExeOther);
}
const bool shutdown = ui->cb_Shutdown->isChecked();
const bool started = QProcess::startDetached(executable, {}, dir.absolutePath());
if (started && shutdown && sGui)