Listen: use fs/XDG.hxx

This keeps one central place for the XDG switch.  Specifically, this
disables the XDG listener on Apple, where XDG is not supported.
This commit is contained in:
Max Kellermann 2018-10-31 14:30:34 +01:00
parent f47696f5f8
commit 9fc00a817b

View File

@ -31,6 +31,7 @@
#include "system/Error.hxx" #include "system/Error.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/XDG.hxx"
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>
@ -73,10 +74,7 @@ listen_systemd_activation(ClientListener &listener)
static bool static bool
ListenXdgRuntimeDir(ClientListener &listener) noexcept ListenXdgRuntimeDir(ClientListener &listener) noexcept
{ {
#if defined(_WIN32) || defined(ANDROID) || !defined(HAVE_UN) #if defined(USE_XDG) && defined(HAVE_UN)
(void)listener;
return false;
#else
if (geteuid() == 0) if (geteuid() == 0)
/* this MPD instance is a system-wide daemon; don't /* this MPD instance is a system-wide daemon; don't
use $XDG_RUNTIME_DIR */ use $XDG_RUNTIME_DIR */
@ -107,6 +105,9 @@ ListenXdgRuntimeDir(ClientListener &listener) noexcept
socket_path.c_str()); socket_path.c_str());
return false; return false;
} }
#else
(void)listener;
return false;
#endif #endif
} }