From 824d30caf506eb95dd1943d9bd86194f04e6214c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 17 Mar 2018 10:28:19 +0100 Subject: QStandardPaths has a function to find executables. --- common/resourceaccess.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'common') diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 2846b23..85dda6d 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -46,6 +46,7 @@ #include #include #include +#include static void queuedInvoke(const std::function &f, QObject *context = 0) { @@ -217,17 +218,8 @@ KAsync::Job ResourceAccess::Private::initializeSocket() args << resourceInstanceIdentifier << resourceName; //Prefer a binary next to this binary, otherwise fall-back to PATH. Necessary for MacOS bundles because the bundle is not in the PATH. - const QString synchronizerBinaryName = "sink_synchronizer"; - QString synchronizerBinary = [&]() { - const auto path = QCoreApplication::applicationDirPath() + QDir::separator() + synchronizerBinaryName; - if (QFileInfo{path}.isExecutable()) { - return path; - } else { - return synchronizerBinaryName; - } - }(); qint64 pid = 0; - if (QProcess::startDetached(synchronizerBinary, args, QDir::homePath(), &pid)) { + if (QProcess::startDetached(QStandardPaths::findExecutable("sink_synchronizer", {QCoreApplication::applicationDirPath()}), args, QDir::homePath(), &pid)) { SinkTrace() << "Started resource " << pid; return tryToConnect() .onError([this, args](const KAsync::Error &error) { -- cgit v1.2.3