mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 08:20:20 +02:00
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.
This commit is contained in:
parent
89cb70a0d5
commit
179fe33632
2 changed files with 25 additions and 18 deletions
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -247,24 +247,28 @@ scm_init_load_path ()
|
||||||
#endif /* SCM_LIBRARY_DIR */
|
#endif /* SCM_LIBRARY_DIR */
|
||||||
|
|
||||||
{
|
{
|
||||||
char *home;
|
char cachedir[1024];
|
||||||
|
char *e;
|
||||||
home = getenv ("HOME");
|
|
||||||
#ifdef HAVE_GETPWENT
|
#ifdef HAVE_GETPWENT
|
||||||
if (!home)
|
struct passwd *pwd;
|
||||||
{
|
#endif
|
||||||
struct passwd *pwd;
|
|
||||||
pwd = getpwuid (getuid ());
|
#define FALLBACK_DIR "guile/ccache/"SCM_EFFECTIVE_VERSION
|
||||||
if (pwd)
|
|
||||||
home = pwd->pw_dir;
|
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
|
||||||
|
else if ((pwd = getpwuid (getuid ())) && pwd->pw_dir)
|
||||||
|
snprintf (cachedir, sizeof(cachedir), "%s/.cache/" FALLBACK_DIR,
|
||||||
|
pwd->pw_dir);
|
||||||
#endif /* HAVE_GETPWENT */
|
#endif /* HAVE_GETPWENT */
|
||||||
if (home)
|
else
|
||||||
{ char buf[1024];
|
cachedir[0] = 0;
|
||||||
snprintf (buf, sizeof(buf),
|
|
||||||
"%s/.guile-ccache/" SCM_EFFECTIVE_VERSION, home);
|
if (cachedir[0])
|
||||||
*scm_loc_compile_fallback_path = scm_from_locale_string (buf);
|
*scm_loc_compile_fallback_path = scm_from_locale_string (cachedir);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
env = getenv ("GUILE_LOAD_PATH");
|
env = getenv ("GUILE_LOAD_PATH");
|
||||||
|
|
|
@ -131,7 +131,10 @@
|
||||||
(else (car %load-compiled-extensions))))
|
(else (car %load-compiled-extensions))))
|
||||||
(and %compile-fallback-path
|
(and %compile-fallback-path
|
||||||
(let ((f (string-append
|
(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))))
|
(compiled-extension))))
|
||||||
(and (false-if-exception (ensure-writable-dir (dirname f)))
|
(and (false-if-exception (ensure-writable-dir (dirname f)))
|
||||||
f))))
|
f))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue