[X2Go-Commits] [x2goclient] 125/257: pulsemanager.cpp: generate platform-dependent values for member variables server_working_dir_ and server_binary_ in constructor.
git-admin at x2go.org
git-admin at x2go.org
Mon Nov 28 16:05:33 CET 2016
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/osx
in repository x2goclient.
commit 91cebd4541abacae82b3d81ddafb7e83417e043b
Author: Mihai Moldovan <ionic at 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 5a82445..e3016b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -213,6 +213,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.
[ Bernard Cafarelli ]
* New upstream version (4.0.5.3):
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
More information about the x2go-commits
mailing list