mingw: use $APPDATA as a possible root for cachedir.
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 15 Feb 2011 15:35:03 +0000 (16:35 +0100)
committerAndy Wingo <wingo@pobox.com>
Thu, 16 Jun 2011 22:01:39 +0000 (00:01 +0200)
* libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using
$LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set.

libguile/load.c

index fa19a2a..8cc08e8 100644 (file)
@@ -293,6 +293,12 @@ scm_init_load_path ()
       snprintf (cachedir, sizeof(cachedir), "%s/.cache/" FALLBACK_DIR,
                 pwd->pw_dir);
 #endif /* HAVE_GETPWENT */
+#ifdef __MINGW32__
+    else if ((e = getenv ("LOCALAPPDATA")))
+      snprintf (cachedir, sizeof (cachedir), "%s/.cache/" FALLBACK_DIR, e);
+    else if ((e = getenv ("APPDATA")))
+      snprintf (cachedir, sizeof (cachedir), "%s/.cache/" FALLBACK_DIR, e);
+#endif /* __MINGW32__ */
     else
       cachedir[0] = 0;