This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient.
commit 23e1d9ce0a63d645948c875e191d00aa5b277d5b Author: Mihai Moldovan <io...@ionic.de> Date: Mon Nov 30 04:55:25 2015 +0100 pulsemanager.cpp: generate platform-dependent values for member variables server_working_dir_ and server_binary_ in constructor. We need them right away. --- debian/changelog | 3 +++ src/pulsemanager.cpp | 46 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index d068054..d67c0b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -211,6 +211,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - pulsemanager.cpp: reorder member variables in initialization list. Compile warning fix. - pulsemanager.cpp: add "dummy" start_linux () function. + - pulsemanager.cpp: generate platform-dependent values for member + variables server_working_dir_ and server_binary_ in constructor. We need + them right away. -- X2Go Release Manager <git-ad...@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp index 9c6de0d..bb0bf73 100644 --- a/src/pulsemanager.cpp +++ b/src/pulsemanager.cpp @@ -17,6 +17,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include <unistd.h> +#include <stdlib.h> + #include "pulsemanager.h" #ifndef DEBUG @@ -46,6 +49,43 @@ PulseManager::PulseManager () : pulse_X2Go_ ("/.x2go/pulse"), env_.insert ("USERPROFILE", pulse_dir_.absolutePath ()); env_.insert ("USERNAME", "pulseuser"); #endif // defined (Q_OS_WIN) + + /* Set server binary and working dir paths. */ +#ifdef Q_OS_DARWIN + server_working_dir_ = QString (app_dir_ + "/../exe/"); + server_binary_ = QString (server_working_dir_ + "/pulseaudio"); +#elif defined (Q_OS_WIN) + server_working_dir_ = QString (app_dir_ + "/pulse/"); + server_binary_ = QString (app_dir_ + "/pulse/pulseaudio.exe"); +#elif defined (Q_OS_LINUX) + std::size_t path_len = pathconf (".", _PC_PATH_MAX); + + if (-1 == path_len) { + path_len = 1024; + } + + char *buf, *ptr; + + for (buf = ptr = NULL; ptr == NULL; path_len += 20) { + if (NULL == (buf = realloc (buf, path_len))) { + x2goErrorf (16) << "Could not allocate buffer for getting current working directory!" << std::endl; + abort (); + } + + ptr = getcwd (buf, path_len); + + if ((NULL == ptr) && (ERANGE != erange)) { + x2goErrorf (17) << "getcwd() failed: " << QString (strerror (errno)) << std::endl; + abort (); + } + } + + server_working_dir_ = QString (buf); + server_binary_ = QString ("pulseaudio"); + + free (buf); + buf = ptr = NULL; +#endif // defined (Q_OS_DARWIN) } PulseManager::~PulseManager () { @@ -111,9 +151,6 @@ void PulseManager::start_osx () { server_args_ << "--log-level=debug"; #endif // defined (DEBUG) - server_working_dir_ = QString (app_dir_ + "/../exe/"); - server_binary_ = QString (server_working_dir_ + "/pulseaudio"); - if (generate_server_config () && generate_client_config ()) { cleanup_client_dir (); @@ -132,9 +169,6 @@ void PulseManager::start_win () { server_args_ << "--log-level=debug"; #endif // defined (DEBUG) - server_working_dir_ = QString (app_dir_ + "/pulse/"); - server_binary_ = QString (app_dir_ + "/pulse/pulseaudio.exe"); - if (generate_server_config () && generate_client_config ()) { create_client_dir (); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org http://lists.x2go.org/listinfo/x2go-commits