From a388c89fd532255cb22700b285a88c8ddc66294d Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 19 Oct 2016 10:50:26 +0200 Subject: [PATCH] Merge with develop --- code/ryzom/client/src/login_patch.cpp | 2 +- code/ryzom/client/src/network_connection.cpp | 11 +++++++++- .../src/client_config_dialog.cpp | 5 +++++ .../tools/client/ryzom_installer/src/main.cpp | 5 +++++ .../client/ryzom_installer/src/mainwindow.cpp | 20 +++++++++++++++++-- .../client/ryzom_installer/src/utils.cpp | 8 ++++++++ 6 files changed, 47 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 0afbdf5f4..0f867ff70 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -952,7 +952,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool // use exec command under OS X contentSuffix += toString("exec \"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); #else - contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); + contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID &\n", additionalParams.c_str()); #endif } #endif diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 5a7e42179..d78fd6199 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -2756,7 +2756,16 @@ void CNetworkConnection::sendSystemDisconnection() uint32 length = message.length(); if (_Connection.connected()) - _Connection.send (message.buffer(), length); + { + try + { + _Connection.send(message.buffer(), length); + } + catch (const ESocket &e) + { + nlwarning("Socket exception: %s", e.what()); + } + } //sendUDP (&(_Connection), message.buffer(), length); statsSend(length); 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 56568d4a2..31fcfd1ac 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 @@ -177,6 +177,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..5d61f0924 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -137,11 +137,19 @@ 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()); // define this profile as default one - CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex); + if (started) + { + CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex); + CConfigFile::getInstance()->save(); + } } void CMainWindow::onConfigureClicked() @@ -164,9 +172,17 @@ 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); + if (started) + { + CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex); + CConfigFile::getInstance()->save(); + } } void CMainWindow::onProfiles() 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);