mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-19 14:07:01 +01:00
utils: 'cache-directory' gracefully deals with unset 'HOME'.
Fixes <http://bugs.gnu.org/23165>. * guix/utils.scm (cache-directory): Use 'getpwuid' when 'HOME' is unset.
This commit is contained in:
parent
cd76fbde6f
commit
dd1d09f7e4
1 changed files with 2 additions and 1 deletions
|
@ -808,7 +808,8 @@ (define (same? x)
|
||||||
(define (cache-directory)
|
(define (cache-directory)
|
||||||
"Return the cache directory for Guix, by default ~/.cache/guix."
|
"Return the cache directory for Guix, by default ~/.cache/guix."
|
||||||
(or (getenv "XDG_CONFIG_HOME")
|
(or (getenv "XDG_CONFIG_HOME")
|
||||||
(and=> (getenv "HOME")
|
(and=> (or (getenv "HOME")
|
||||||
|
(passwd:dir (getpwuid (getuid))))
|
||||||
(cut string-append <> "/.cache/guix"))))
|
(cut string-append <> "/.cache/guix"))))
|
||||||
|
|
||||||
(define (readlink* file)
|
(define (readlink* file)
|
||||||
|
|
Loading…
Reference in a new issue