From: Markus Goetz Date: Fri, 31 Aug 2018 13:03:33 +0000 (+0200) Subject: SocketApi: Fix owncloud/enterprise#2938 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~276 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5da48a5239eeb82c086da8f8c2f489fe82f86996;p=nextcloud-desktop.git SocketApi: Fix owncloud/enterprise#2938 --- diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 427110b46..3e6291815 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -58,6 +58,9 @@ #include +#ifdef Q_OS_MAC +#include +#endif // This is the version that is returned when the client asks for the VERSION. // The first number should be changed if there is an incompatible change that breaks old clients. @@ -198,8 +201,19 @@ SocketApi::SocketApi(QObject *parent) // Example for official signed packages: "9B5WD74GWJ." "com.owncloud.desktopclient" ".socketApi" socketPath = SOCKETAPI_TEAM_IDENTIFIER_PREFIX APPLICATION_REV_DOMAIN ".socketApi"; #ifdef Q_OS_MAC + int ret = 0; + CFURLRef url = (CFURLRef)CFAutorelease((CFURLRef)CFBundleCopyBundleURL(CFBundleGetMainBundle())); + QString bundlePath = QUrl::fromCFURL(url).path(); + QString cmd; + // Tell Finder to use the Extension (checking it from System Preferences -> Extensions) - system("pluginkit -e use -i " APPLICATION_REV_DOMAIN ".FinderSyncExt &"); + cmd = QString("pluginkit -v -e use -i " APPLICATION_REV_DOMAIN ".FinderSyncExt"); + ret = system(cmd.toLocal8Bit()); + + // Add it again. This was needed for Mojave to trigger a load. + cmd = QString("pluginkit -v -a ") + bundlePath + "Contents/PlugIns/FinderSyncExt.appex/"; + ret = system(cmd.toLocal8Bit()); + #endif } else if (Utility::isLinux() || Utility::isBSD()) { QString runtimeDir; @@ -238,11 +252,6 @@ SocketApi::~SocketApi() // All remaining sockets will be destroyed with _localServer, their parent ASSERT(_listeners.isEmpty() || _listeners.first().socket->parent() == &_localServer); _listeners.clear(); - -#ifdef Q_OS_MAC - // Unload the extension (uncheck from System Preferences -> Extensions) - system("pluginkit -e ignore -i " APPLICATION_REV_DOMAIN ".FinderSyncExt &"); -#endif } void SocketApi::slotNewConnection()