guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-0-4-g179f


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-0-4-g179fe33
Date: Sat, 20 Jun 2009 12:26:34 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=179fe3363241ea1aeb48f1f63d13d2dd12196dcf

The branch, master has been updated
       via  179fe3363241ea1aeb48f1f63d13d2dd12196dcf (commit)
      from  89cb70a0d5f365ebdfcc0257d6cab4a80a9f6a74 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 179fe3363241ea1aeb48f1f63d13d2dd12196dcf
Author: Andy Wingo <address@hidden>
Date:   Sat Jun 20 14:26:54 2009 +0200

    put autocompiled files into ~/.cache or $XDG_CACHE_HOME
    
    * module/system/base/compile.scm (compiled-file-name): Remove unneeded
      path separator.
    
    * libguile/load.c (scm_init_load_path): Change so the default cache path
      is ~/.cache/guile/ccache/1.9, and respect $XDG_CACHE_HOME.

-----------------------------------------------------------------------

Summary of changes:
 libguile/load.c                |   36 ++++++++++++++++++++----------------
 module/system/base/compile.scm |    5 ++++-
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/libguile/load.c b/libguile/load.c
index d8139e6..890b0f8 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006, 2009 Free Software 
Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -247,24 +247,28 @@ scm_init_load_path ()
 #endif /* SCM_LIBRARY_DIR */
 
   {
-    char *home;
+    char cachedir[1024];
+    char *e;
+#ifdef HAVE_GETPWENT
+    struct passwd *pwd;
+#endif
 
-    home = getenv ("HOME");
+#define FALLBACK_DIR "guile/ccache/"SCM_EFFECTIVE_VERSION
+
+    if ((e = getenv ("XDG_CACHE_HOME")))
+      snprintf (cachedir, sizeof(cachedir), "%s" FALLBACK_DIR, e);
+    else if ((e = getenv ("HOME")))
+      snprintf (cachedir, sizeof(cachedir), "%s/.cache/" FALLBACK_DIR, e);
 #ifdef HAVE_GETPWENT
-    if (!home)
-      {
-        struct passwd *pwd;
-        pwd = getpwuid (getuid ());
-        if (pwd)
-          home = pwd->pw_dir;
-      }
+    else if ((pwd = getpwuid (getuid ())) && pwd->pw_dir)
+      snprintf (cachedir, sizeof(cachedir), "%s/.cache/" FALLBACK_DIR,
+                pwd->pw_dir);
 #endif /* HAVE_GETPWENT */
-    if (home)
-      { char buf[1024];
-        snprintf (buf, sizeof(buf),
-                  "%s/.guile-ccache/" SCM_EFFECTIVE_VERSION, home);
-        *scm_loc_compile_fallback_path = scm_from_locale_string (buf);
-      }
+    else
+      cachedir[0] = 0;
+
+    if (cachedir[0])
+      *scm_loc_compile_fallback_path = scm_from_locale_string (cachedir);
   }
 
   env = getenv ("GUILE_LOAD_PATH");
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index dfe8823..22f8e04 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -131,7 +131,10 @@
           (else (car %load-compiled-extensions))))
   (and %compile-fallback-path
        (let ((f (string-append
-                 %compile-fallback-path "/" (canonicalize-path file)
+                 %compile-fallback-path
+                 ;; no need for '/' separator here, canonicalize-path
+                 ;; will give us an absolute path
+                 (canonicalize-path file)
                  (compiled-extension))))
          (and (false-if-exception (ensure-writable-dir (dirname f)))
               f))))


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]