aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-04-27 20:43:24 +0200
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-04-27 20:43:24 +0200
commitda781760634d94c61dc268e3866f896cf9a50b7e (patch)
treeed0abe641d70ad1a382b9f14b1c1e370776a1964 /uzbl.c
parentee4eb736f37ecb125b5898fd0c06e445745f1e55 (diff)
parent62669758bf513b375c141f0d38d07186237f2f64 (diff)
merge from barrucadu
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/uzbl.c b/uzbl.c
index 85b7cd4..3528bf4 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
@@ -245,7 +245,7 @@ parse_command(const char *cmd) {
unsigned int i;
Command *c = NULL;
char buffer[512];
- strcpy(buffer,cmd);
+ strcpy (buffer, cmd);
char * command_name = strtok (buffer, " ");
gchar * command_param = strtok (NULL, " ,");
@@ -451,8 +451,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);
@@ -464,7 +464,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);
@@ -582,6 +582,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);