mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Follow XDG directory spec for RPC socket & overlay pipe
If the XDG_RUNTIME_DIR environment variable is present the overlay
pipe and RPC socket will be created at..
$XDG_RUNTIME_DIR/MumbleSocket
$XDG_RUNTIME_DIR/MumbleOverlayPipe
This commit is contained in:
parent
a96a8e79a2
commit
82ca800803
@ -180,7 +180,13 @@ static void newContext(Context * ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
if (home) {
|
||||
char *xdgRuntimeDir = getenv("XDG_RUNTIME_DIR");
|
||||
|
||||
if (xdgRuntimeDir != NULL) {
|
||||
ctx->saName.sun_family = PF_UNIX;
|
||||
strcpy(ctx->saName.sun_path, xdgRuntimeDir);
|
||||
strcat(ctx->saName.sun_path, "/MumbleOverlayPipe");
|
||||
} else if (home) {
|
||||
ctx->saName.sun_family = PF_UNIX;
|
||||
strcpy(ctx->saName.sun_path, home);
|
||||
strcat(ctx->saName.sun_path, "/.MumbleOverlayPipe");
|
||||
|
||||
@ -92,7 +92,17 @@ Overlay::Overlay() : QObject() {
|
||||
#ifdef Q_OS_WIN
|
||||
pipepath = QLatin1String("MumbleOverlayPipe");
|
||||
#else
|
||||
pipepath = QDir::home().absoluteFilePath(QLatin1String(".MumbleOverlayPipe"));
|
||||
{
|
||||
QString xdgRuntimePath = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_RUNTIME_DIR"));
|
||||
QDir xdgRuntimeDir = QDir(xdgRuntimePath);
|
||||
|
||||
if (! xdgRuntimePath.isNull() && xdgRuntimeDir.exists()) {
|
||||
pipepath = xdgRuntimeDir.absoluteFilePath(QLatin1String("MumbleOverlayPipe"));
|
||||
} else {
|
||||
pipepath = QDir::home().absoluteFilePath(QLatin1String(".MumbleOverlayPipe"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QFile f(pipepath);
|
||||
if (f.exists()) {
|
||||
|
||||
@ -231,7 +231,17 @@ SocketRPC::SocketRPC(const QString &basename, QObject *p) : QObject(p) {
|
||||
#ifdef Q_OS_WIN
|
||||
pipepath = basename;
|
||||
#else
|
||||
pipepath = QDir::home().absoluteFilePath(QLatin1String(".") + basename + QLatin1String("Socket"));
|
||||
{
|
||||
QString xdgRuntimePath = QProcessEnvironment::systemEnvironment().value(QLatin1String("XDG_RUNTIME_DIR"));
|
||||
QDir xdgRuntimeDir = QDir(xdgRuntimePath);
|
||||
|
||||
if (! xdgRuntimePath.isNull() && xdgRuntimeDir.exists()) {
|
||||
pipepath = xdgRuntimeDir.absoluteFilePath(basename + QLatin1String("Socket"));
|
||||
} else {
|
||||
pipepath = QDir::home().absoluteFilePath(QLatin1String(".") + basename + QLatin1String("Socket"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QFile f(pipepath);
|
||||
if (f.exists()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user