File config-Correctly-resolve-in-default-config-path.patch of Package goodnigt-mouse

From a9e464afc91b62ce7b06510ef8f1c86b305f49ce Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
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();
-- 
2.44.0

openSUSE Build Service is sponsored by