aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Barrucadu <mike@barrucadu.co.uk>2009-04-28 02:00:21 +0800
committerGravatar dusanx <ef_dva@yahoo.com>2009-04-28 03:27:00 +0800
commitfba57a2cd5510f6686c02b2e3cf4677ea90662d6 (patch)
tree95d6365aa21c0af93feb6661c7ab602af164562a
parent07523298d96ee9f489eca878d369af73d3419719 (diff)
XDG_CONFIG_HOME now works (set in main().
Signed-off-by: dusanx <ef_dva@yahoo.com>
-rw-r--r--uzbl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/uzbl.c b/uzbl.c
index de00c5f..0af80c5 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -101,7 +101,7 @@ typedef struct
} Command;
/* XDG stuff */
-char *XDG_CONFIG_HOME_default = "~/.config";
+char *XDG_CONFIG_HOME_default[256];
char *XDG_CONFIG_DIRS_default = "/etc/xdg";
static void
@@ -448,8 +448,8 @@ settings_init () {
if (! config_file) {
const char* XDG_CONFIG_HOME = getenv ("XDG_CONFIG_HOME");
char conf[256];
- if (! XDG_CONFIG_HOME) {
- XDG_CONFIG_HOME = XDG_CONFIG_HOME_default;
+ if (! XDG_CONFIG_HOME || ! strcmp (XDG_CONFIG_HOME, "")) {
+ XDG_CONFIG_HOME = (char *)XDG_CONFIG_HOME_default;
}
printf("XDG_CONFIG_HOME: %s\n", XDG_CONFIG_HOME);
@@ -461,7 +461,7 @@ settings_init () {
} else {
// Now we check $XDG_CONFIG_DIRS
char *XDG_CONFIG_DIRS = getenv ("XDG_CONFIG_DIRS");
- if (! XDG_CONFIG_DIRS)
+ if (! XDG_CONFIG_DIRS || ! strcmp (XDG_CONFIG_DIRS, ""))
XDG_CONFIG_DIRS = XDG_CONFIG_DIRS_default;
printf("XDG_CONFIG_DIRS: %s\n", XDG_CONFIG_DIRS);
@@ -579,6 +579,9 @@ main (int argc, char* argv[]) {
if (!g_thread_supported ())
g_thread_init (NULL);
+ strcat ((char *) XDG_CONFIG_HOME_default, getenv ("HOME"));
+ strcat ((char *) XDG_CONFIG_HOME_default, "/.config");
+
GError *error = NULL;
GOptionContext* context = g_option_context_new ("- some stuff here maybe someday");
g_option_context_add_main_entries (context, entries, NULL);