From bd829e72c6ee269c51e7ba0c51254fada68fc421 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 19 Oct 2016 10:46:56 +0200 Subject: [PATCH] Fixed: Try to put executable permissions before to launch an executable under UNIX --- .../client/client_config_qt/src/client_config_dialog.cpp | 5 +++++ code/ryzom/tools/client/ryzom_installer/src/main.cpp | 5 +++++ .../ryzom/tools/client/ryzom_installer/src/mainwindow.cpp | 8 ++++++++ code/ryzom/tools/client/ryzom_installer/src/utils.cpp | 8 ++++++++ 4 files changed, 26 insertions(+) diff --git a/code/ryzom/tools/client/client_config_qt/src/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/src/client_config_dialog.cpp index 5ec5b2a60..ecac3ccdb 100644 --- a/code/ryzom/tools/client/client_config_qt/src/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/src/client_config_dialog.cpp @@ -172,6 +172,11 @@ void CClientConfigDialog::onClickPlay() clientFullPath += "ryzom_client"; #endif +#ifndef Q_OS_WIN32 + // fix executable permissions under UNIX + QFile::setPermissions(clientFullPath, QFile::permissions(clientFullPath) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); +#endif + started = QProcess::startDetached(clientFullPath, arguments); onClickOK(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 6b664ace0..3420ef42e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -271,6 +271,11 @@ int main(int argc, char *argv[]) if (restartInstaller) { #ifndef _DEBUG +#ifndef Q_OS_WIN32 + // fix executable permissions under UNIX + QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); +#endif + if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; #endif } diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index 822570fec..d6f356f8e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -137,6 +137,10 @@ void CMainWindow::onPlayClicked() arguments << profile.id; arguments << profile.arguments.split(' '); +#ifndef Q_OS_WIN32 + QFile::setPermissions(executable, QFile::permissions(executable) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); +#endif + // launch the game with all arguments and from server root directory (to use right data) bool started = QProcess::startDetached(executable, arguments, server.getDirectory()); @@ -164,6 +168,10 @@ void CMainWindow::onConfigureClicked() arguments << "-p"; arguments << profile.id; +#ifndef Q_OS_WIN32 + QFile::setPermissions(executable, QFile::permissions(executable) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); +#endif + bool started = QProcess::startDetached(executable, arguments); CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex); diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 9a08b4ac8..0a31629f9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -408,6 +408,14 @@ QString appendShortcutExtension(const QString &shortcut) QString getVersionFromExecutable(const QString &path) { + // check if file exists + if (!QFile::exists(path)) return ""; + +#ifndef Q_OS_WIN32 + // fix executable permissions under UNIX + QFile::setPermissions(path, QFile::permissions(path) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); +#endif + // launch executable with --version argument QProcess process; process.setProcessChannelMode(QProcess::MergedChannels);