summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/toxic/configdir.c14
1 files changed, 9 insertions, 5 deletions
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)
98 98
99 snprintf(user_config_dir, len, "%s/Library/Application Support", home); 99 snprintf(user_config_dir, len, "%s/Library/Application Support", home);
100# else /* __APPLE__ */ 100# else /* __APPLE__ */
101 len = strlen(home) + strlen("/.config") + 1;
102 user_config_dir = malloc(len);
103 101
104 if (user_config_dir == NULL) { 102 if (!(user_config_dir = getenv("XDG_CONFIG_HOME"))) {
105 return NULL; 103 len = strlen(home) + strlen("/.config") + 1;
104 user_config_dir = malloc(len);
105
106 if (user_config_dir == NULL) {
107 return NULL;
108 }
109
110 snprintf(user_config_dir, len, "%s/.config", home);
106 } 111 }
107 112
108 snprintf(user_config_dir, len, "%s/.config", home);
109# endif /* __APPLE__ */ 113# endif /* __APPLE__ */
110 114
111 return user_config_dir; 115 return user_config_dir;