tUse GLib to get app data directory - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
commit 6860dd12a2d0843875ee263bdd381822580a061d
parent c35ba28b21ec5a92791d0c3c3ae10180df2b4851
Author: Ben Webb 
Date:   Tue,  1 Dec 2020 22:38:14 -0800

Use GLib to get app data directory

There is already a GLib function, g_get_user_config_dir(),
tto get the Windows per-user config directory, so use that.

Diffstat:
  M src/winmain.c                       |      10 ++--------

1 file changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/src/winmain.c b/src/winmain.c
t@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
t@@ -110,13 +109,8 @@ gchar *appdata_path = NULL;
 
 static void GetAppDataPath()
 {
-  char shfolder[MAX_PATH];
-
-  if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA,
-                                 NULL, 0, shfolder))) {
-    appdata_path = g_strdup_printf("%s/dopewars", shfolder);
-    mkdir(appdata_path);
-  }
+  appdata_path = g_strdup_printf("%s/dopewars", g_get_user_config_dir());
+  mkdir(appdata_path);
 }
 
 static void LogFileStart()