summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xkb/ddxLoad.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 2d203ce11..18814264a 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -31,6 +31,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkb-config.h>
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <X11/X.h>
#include <X11/Xos.h>
@@ -69,9 +70,17 @@ OutputDirectory(char *outdir, size_t size)
/* Can we write an xkm and then open it too? */
if (access(XKM_OUTPUT_DIR, W_OK | X_OK) == 0) {
directory = XKM_OUTPUT_DIR;
- if (XKM_OUTPUT_DIR[strlen(XKM_OUTPUT_DIR) - 1] != '/')
- pathsep = "/";
+ } else {
+ const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
+
+ if (xdg_runtime_dir && xdg_runtime_dir[0] == '/' &&
+ access(xdg_runtime_dir, W_OK | X_OK) == 0)
+ directory = xdg_runtime_dir;
}
+
+ if (directory && directory[strlen(directory) - 1] != '/')
+ pathsep = "/";
+
#else
directory = Win32TempDir();
pathsep = "\\";