[Pkg-owncloud-commits] [owncloud-client] 170/219: SocketApi: Save the socket in $XDG_RUNTIME/<appname>/socket
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit a587148c736c247804203ea51452cba9b2926606
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Sep 29 13:54:13 2014 +0200
SocketApi: Save the socket in $XDG_RUNTIME/<appname>/socket
---
src/mirall/socketapi.cpp | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index 127c51f..81e2376 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -35,6 +35,11 @@
#include <QApplication>
#include <QLocalSocket>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <QStandardPaths>
+#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.
// The second number should be changed when there are new features.
@@ -232,14 +237,26 @@ SocketApi::SocketApi(QObject* parent)
}
#else
QString socketPath;
+
if (Utility::isWindows()) {
socketPath = QLatin1String("\\\\.\\pipe\\")
+ Theme::instance()->appName();
} else {
- socketPath = MirallConfigFile().configPathWithAppName().append(QLatin1String("socket"));
+ QString runtimeDir;
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
+#else
+ runtimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR"));
+#endif
+ socketPath = runtimeDir + "/" + Theme::instance()->appName() + "/socket";
}
QLocalServer::removeServer(socketPath);
+ QFileInfo info(socketPath);
+ if (!info.dir().exists()) {
+ bool result = info.dir().mkpath(".");
+ DEBUG << "creating" << info.dir().path() << result;
+ }
if(!_localServer.listen(socketPath)) {
DEBUG << "can't start server" << socketPath;
} else {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list