This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient.
commit 03e96e7ab23bf1a0f2c35263937f8bc02cd721a2 Author: Mihai Moldovan <io...@ionic.de> Date: Mon Jun 20 23:58:12 2016 +0200 src/pulsemanager.cpp: auto-detect PA binary in $PATH and MacPorts default prefix as well on OS X. --- debian/changelog | 2 ++ src/pulsemanager.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1f73293..d51f431 100644 --- a/debian/changelog +++ b/debian/changelog @@ -337,6 +337,8 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium - src/x2goutils.{cpp,h}: add new function find_binary (). Searches for a specific binary in a colon-separated list of paths. Really just a compat function, as Qt 5 includes QStandardPaths::findExecutable (). + - src/pulsemanager.cpp: auto-detect PA binary in $PATH and MacPorts + default prefix as well on OS X. * debian/control: - Maintainer change in package: X2Go Developers <x2go-...@lists.x2go.org>. - Uploaders: add myself. Also, force a rebuild due to the changed diff --git a/src/pulsemanager.cpp b/src/pulsemanager.cpp index ce7ba24..1e23d89 100644 --- a/src/pulsemanager.cpp +++ b/src/pulsemanager.cpp @@ -21,6 +21,12 @@ #include <stdlib.h> #include <QSysInfo> +#if QT_VERSION < 0x050000 +#include "x2goutils.h" +#else /* QT_VERSION < 0x050000 */ +#include <QStandardPaths> +#endif /* QT_VERSION < 0x050000 */ + #include "pulsemanager.h" #include "x2gologdebug.h" @@ -54,8 +60,69 @@ PulseManager::PulseManager () : app_dir_ (QApplication::applicationDirPath ()), /* Set server binary and working dir paths. */ #ifdef Q_OS_DARWIN + /* Assume bundled PA first. */ server_working_dir_ = QString (app_dir_ + "/../exe/"); server_binary_ = QString (server_working_dir_ + "/pulseaudio"); + +#if QT_VERSION < 0x050000 + QProcessEnvironment tmp_env = QProcessEnvironment::systemEnvironment (); + QString path_val = tmp_env.value ("PATH"); + + QStringList to_front, to_back; + to_front << "/opt/local/bin"; + to_back << "/usr/local/bin"; + + add_to_path (path_val, to_back); + add_to_path (path_val, to_front, false); + + server_binary_ = find_binary (server_working_dir_, "pulseaudio"); + + if (server_binary_.isEmpty ()) { + server_binary_ = find_binary (path_val, "pulseaudio"); + + if (server_binary_.isEmpty ()) { + x2goErrorf (29) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."; + abort (); + } + } +#else /* QT_VERSION < 0x050000 */ + QStringList search_paths; + search_paths << server_working_dir_; + + server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths); + + if (server_binary_.isEmpty ()) { + search_paths = QStringList (); + search_paths << "/opt/local/bin"; /* MacPorts default prefix, FIXME: might need to make that configurable. */ + + server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths); + + if (server_binary_.isEmpty ()) { + search_paths = QStringList (); + + server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths); + + if (server_binary_.isEmpty ()) { + search_paths = QStringList (); + search_paths << "/usr/local/bin"; /* Homebrew or random stuff. Probably even both intermingled... */ + + server_binary_ = QStandardPaths::findExecutable ("pulseaudio", search_paths); + + if (server_binary_.isEmpty ()) { + x2goErrorf (28) << "Unable to find PulseAudio binary. Neither bundled, nor found in $PATH nor additional directories."; + abort (); + } + } + } + } +#endif /* QT_VERSION < 0x050000 */ + + QFileInfo tmp_file_info = QFileInfo (server_binary_); + server_working_dir_ = tmp_file_info.canonicalPath (); + + x2goDebug << "Found PA binary as " << server_binary_ << endl; + x2goDebug << "Corresponding working dir: " << server_working_dir_ << endl; + #elif defined (Q_OS_WIN) server_working_dir_ = QString (app_dir_ + "/pulse/"); server_binary_ = QString (app_dir_ + "/pulse/pulseaudio.exe"); -- 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