summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-18 17:07:35 -0700
committerirungentoo <irungentoo@gmail.com>2013-08-18 17:07:35 -0700
commit783a24a0c42754823ebf0d9056818f25efaa87f3 (patch)
tree017d496ac0116d786d30d76c458cfcd9e915805f
parent9533cea058aafb96d7129816510d4a3fcb46cbed (diff)
parent29b61c574b91334668b9ebebf854ad65af568f2c (diff)
Merge pull request #494 from frh/master
Made configdir check XDG_CONFIG_HOME for config dir
-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;