summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/resourceaccess.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index 201c023..2846b23 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -215,16 +215,27 @@ KAsync::Job<void> ResourceAccess::Private::initializeSocket()
215 return KAsync::error(); 215 return KAsync::error();
216 } 216 }
217 args << resourceInstanceIdentifier << resourceName; 217 args << resourceInstanceIdentifier << resourceName;
218
219 //Prefer a binary next to this binary, otherwise fall-back to PATH. Necessary for MacOS bundles because the bundle is not in the PATH.
220 const QString synchronizerBinaryName = "sink_synchronizer";
221 QString synchronizerBinary = [&]() {
222 const auto path = QCoreApplication::applicationDirPath() + QDir::separator() + synchronizerBinaryName;
223 if (QFileInfo{path}.isExecutable()) {
224 return path;
225 } else {
226 return synchronizerBinaryName;
227 }
228 }();
218 qint64 pid = 0; 229 qint64 pid = 0;
219 if (QProcess::startDetached("sink_synchronizer", args, QDir::homePath(), &pid)) { 230 if (QProcess::startDetached(synchronizerBinary, args, QDir::homePath(), &pid)) {
220 SinkTrace() << "Started resource " << pid; 231 SinkTrace() << "Started resource " << pid;
221 return tryToConnect() 232 return tryToConnect()
222 .onError([this, args](const KAsync::Error &error) { 233 .onError([this, args](const KAsync::Error &error) {
223 SinkWarning() << "Failed to connect to started resource: sink_synchronizer " << args; 234 SinkWarning() << "Failed to connect to started resource: sink_synchronizer " << args;
224 }); 235 });
225 } else { 236 } else {
226 SinkWarning() << "Failed to start resource"; 237 SinkError() << "Failed to start resource";
227 return KAsync::error(-1, "Failed to start resource"); 238 return KAsync::error(-1, "Failed to start resource.");
228 } 239 }
229 } else { 240 } else {
230 SinkTrace() << "Connected to resource, without having to start it."; 241 SinkTrace() << "Connected to resource, without having to start it.";