Merge pull request #1818 from varjolintu/unix_socket_location

Change Unix socket location
This commit is contained in:
TheZ3ro
2018-05-16 09:41:44 +02:00
committed by GitHub

View File

@@ -134,11 +134,12 @@ void NativeMessagingBase::sendReply(const QString& reply)
QString NativeMessagingBase::getLocalServerPath() const
{
const QString serverPath = "/kpxc_server";
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// Use XDG_RUNTIME_DIR instead of /tmp/ if it's available
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + "/kpxc_server";
return path.isEmpty() ? "/tmp/kpxc_server" : path;
// Use XDG_RUNTIME_DIR instead of /tmp if it's available
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
return path.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath : path + serverPath;
#else // Q_OS_MAC, Q_OS_WIN and others
return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/kpxc_server";
return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath;
#endif
}