diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-06-06 16:59:44 +0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-06 13:27:04 -0400 |
commit | 78a0b57e5771305ee4c9b90d13683db7e2e2fbf9 (patch) | |
tree | 350a45fd8ac2a2a8ca9d9be430db7d6ee0d6e8ff | |
parent | 1da1b8f3f1680a81bd98f42ad334f5c6d8995cac (diff) |
compositor: print a clear message when XDG_RUNTIME_DIR is not set
Without this patch, Weston would not start with the message:
creating a keymap file for 44012 bytes failed: No such file or directory
If you do not know, that we use XDG_RUNTIME_DIR for that, the message is
very confusing. Therefore implement a clear error message right at the
start if XDG_RUNTIME_DIR is not set.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
-rw-r--r-- | src/compositor.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compositor.c b/src/compositor.c index 93eeb24..3039c3d 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3088,6 +3088,12 @@ load_module(const char *name, const char *entrypoint, void **handle) return init; } +static const char xdg_error_message[] = + "fatal: environment variable XDG_RUNTIME_DIR is not set.\n" + "Refer to your distribution on how to get it, or\n" + "http://www.freedesktop.org/wiki/Specifications/basedir-spec\n" + "on how to implement it.\n"; + int main(int argc, char *argv[]) { struct wl_display *display; @@ -3129,6 +3135,11 @@ int main(int argc, char *argv[]) argc = parse_options(core_options, ARRAY_LENGTH(core_options), argc, argv); + if (!getenv("XDG_RUNTIME_DIR")) { + fprintf(stderr, xdg_error_message); + exit(EXIT_FAILURE); + } + display = wl_display_create(); loop = wl_display_get_event_loop(display); |