commit 694532df0d13da5c5bb41b337f313567d7b0c823
parent 31da8501666e1e76bc5a98bd8f760026b547cb93
Author: Bastien Dejean <nihilhill@gmail.com>
Date: Tue, 12 Feb 2013 12:42:25 +0100
If XDG_CONFIG_HOME is not defined: use the default
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sxhkd.c b/sxhkd.c
@@ -202,10 +202,10 @@ int main(int argc, char *argv[])
if (config_path == NULL) {
char *config_home = getenv(CONFIG_HOME_ENV);
- if (config_home == NULL)
- err("The following environment variable is not defined: '%s'.\n", CONFIG_HOME_ENV);
- else
+ if (config_home != NULL)
snprintf(config_file, sizeof(config_file), "%s/%s", config_home, CONFIG_PATH);
+ else
+ snprintf(config_file, sizeof(config_file), "%s/%s/%s", getenv("HOME"), ".config", CONFIG_PATH);
} else {
strncpy(config_file, config_path, sizeof(config_file));
}