changeset 691:b5d5d37bbc64

Use th_get_home_dir().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Dec 2019 15:18:47 +0200
parents 6fa9c36d0634
children 863542691130
files main.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Dec 25 11:05:31 2019 +0200
+++ b/main.c	Wed Dec 25 15:18:47 2019 +0200
@@ -2031,16 +2031,13 @@
 
     // Get home directory path
     {
+        setHomeDir = th_get_home_dir();
+
 #if defined(TH_PLAT_WINDOWS)
-        char tmpPath[MAX_PATH];
-        if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK)
-            setHomeDir = th_strdup(tmpPath);
-
         CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
         setConfigDir = th_strdup(setHomeDir);
 #elif defined(USE_XDG)
         const char *xdgConfigDir = getenv("XDG_CONFIG_HOME");
-        setHomeDir = th_strdup(getenv("HOME"));
 
         // If XDG is enabled, try the environment variable first
         if (xdgConfigDir != NULL && strcmp(xdgConfigDir, ""))
@@ -2049,7 +2046,6 @@
             // Nope, try the obvious alternative
             setConfigDir = th_strdup_printf("%s/.config/%s/", setHomeDir, SET_XDG_CONFIG_DIR);
 #else
-        setHomeDir = th_strdup(getenv("HOME"));
         setConfigDir = th_strdup(setHomeDir);
 #endif
     }