summaryrefslogtreecommitdiff
path: root/testing/toxic/configdir.c
diff options
context:
space:
mode:
authorFrederik Holden <frh@server.fake>2013-08-19 01:21:36 +0200
committerFrederik Holden <frh@server.fake>2013-08-19 01:21:36 +0200
commit29b61c574b91334668b9ebebf854ad65af568f2c (patch)
tree017d496ac0116d786d30d76c458cfcd9e915805f /testing/toxic/configdir.c
parent9533cea058aafb96d7129816510d4a3fcb46cbed (diff)
Made configdir check XDG_CONFIG_HOME for config dir
Diffstat (limited to 'testing/toxic/configdir.c')
-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;