From 12074a049f47f5ce7baeb4d7d65ac2f84f0ad80c Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sun, 28 Apr 2024 19:50:02 +0200 Subject: [PATCH] config: Correctly resolve ~ in default config path --- src/config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 843166d..d869be3 100644 --- a/src/config.c +++ b/src/config.c @@ -58,7 +58,10 @@ Config *config_new(int argc, char **argv) // if config path not given use default if (!config_path) - config_path = g_strdup(DEFAULT_CONFIG_PATH); + if(!getenv("HOME")) + config_path = g_strdup(DEFAULT_CONFIG_PATH + 1); + else + config_path = g_strconcat(getenv("HOME"), DEFAULT_CONFIG_PATH + 1, NULL); // get the key file GKeyFile *key_file = g_key_file_new();