[babl] babl-cache: implement a better cache path on Win32
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl-cache: implement a better cache path on Win32
- Date: Sat, 3 Dec 2016 19:58:53 +0000 (UTC)
commit 10007b5bce8a2182100caae8fbe18078c7804009
Author: Edward E <develinthedetail gmail com>
Date: Thu Dec 1 18:39:11 2016 -0600
babl-cache: implement a better cache path on Win32
Use SHGetFolderPathA() to get the user local data path
(the same path GEGL uses for plugins on Win32)
https://bugzilla.gnome.org/show_bug.cgi?id=774491
babl/babl-cache.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index c8a5dbd..723ee50 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -16,6 +16,10 @@
* <http://www.gnu.org/licenses/>.
*/
+#ifdef _WIN32
+#include <shlobj.h>
+#endif
+
#include <time.h>
#include <sys/stat.h>
#include "config.h"
@@ -77,8 +81,13 @@ static const char *fish_cache_path (void)
if (getenv ("HOME"))
sprintf (path, "%s/.cache/babl/babl-fishes", getenv("HOME"));
#else
- if (getenv ("TEMP"))
+{
+ char win32path[4096];
+ if (SHGetFolderPathA (NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, win32path) == S_OK)
+ sprintf (path, "%s\\%s\\babl-fishes.txt", win32path, BABL_LIBRARY);
+ else if (getenv ("TEMP"))
sprintf (path, "%s\\babl-fishes.txt", getenv("TEMP"));
+}
#endif
if (stat (path, &stat_buf)==0 && S_ISREG(stat_buf.st_mode))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]