changeset 485:4a3d561d5406

Return empty directory paths under Windows if we can't retrieve AppData directory in th_get_home_dir() and th_get_data_dir().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 04 May 2019 03:00:23 +0300
parents 58b744131b86
children bf984b494f07
files th_file.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_file.c	Tue Feb 19 09:49:41 2019 +0200
+++ b/th_file.c	Sat May 04 03:00:23 2019 +0300
@@ -27,6 +27,9 @@
     char tmpPath[MAX_PATH];
     if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK)
         return th_strdup(tmpPath);
+    else
+        return th_strdup("");
+
 #elif defined(TH_PLAT_DOS)
     return th_strdup("C:\\");
 #else
@@ -41,6 +44,9 @@
     char tmpPath[MAX_PATH];
     if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK)
         return th_strdup(tmpPath);
+    else
+        return th_strdup("");
+
 #elif defined(TH_PLAT_DOS)
     return th_strdup("C:\\");
 #else