Change Unix socket location

This commit is contained in:
varjolintu 2018-04-06 11:33:17 +03:00
parent 98131c3e5e
commit bf5f82ff27

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
}