From 29b61c574b91334668b9ebebf854ad65af568f2c Mon Sep 17 00:00:00 2001 From: Frederik Holden Date: Mon, 19 Aug 2013 01:21:36 +0200 Subject: Made configdir check XDG_CONFIG_HOME for config dir --- testing/toxic/configdir.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'testing/toxic/configdir.c') diff --git a/testing/toxic/configdir.c b/testing/toxic/configdir.c index 1a62e8ed..a43dd1de 100644 --- a/testing/toxic/configdir.c +++ b/testing/toxic/configdir.c @@ -98,14 +98,18 @@ char *get_user_config_dir(void) snprintf(user_config_dir, len, "%s/Library/Application Support", home); # else /* __APPLE__ */ - len = strlen(home) + strlen("/.config") + 1; - user_config_dir = malloc(len); - if (user_config_dir == NULL) { - return NULL; + if (!(user_config_dir = getenv("XDG_CONFIG_HOME"))) { + len = strlen(home) + strlen("/.config") + 1; + user_config_dir = malloc(len); + + if (user_config_dir == NULL) { + return NULL; + } + + snprintf(user_config_dir, len, "%s/.config", home); } - snprintf(user_config_dir, len, "%s/.config", home); # endif /* __APPLE__ */ return user_config_dir; -- cgit v1.2.3