diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-07-28 14:51:44 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-07-28 18:09:43 +0200 |
commit | f0e492f0a54f184e47c0bd639ad338b1b783d258 (patch) | |
tree | 65725a2b73771c6ba90e96bd2dccb8dbc673160c /guix/ui.scm | |
parent | 6f0f55148d8f70ff5bb7455689a4e78b1807d555 (diff) | |
download | gnu-guix-f0e492f0a54f184e47c0bd639ad338b1b783d258.tar gnu-guix-f0e492f0a54f184e47c0bd639ad338b1b783d258.tar.gz |
utils: Factorize XDG directory handling.
* guix/ui.scm (config-directory): Remove.
* guix/utils.scm (xdg-directory, config-directory): New procedures.
(cache-directory): Rewrite in terms of 'xdg-directory'.
* guix/scripts/substitute.scm (%narinfo-cache-directory): Pass #:ensure?
#f to 'cache-directory'.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r-- | guix/ui.scm | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 4bad00e8cf..b0108d0705 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -36,7 +36,6 @@ #:use-module (guix combinators) #:use-module (guix build-system) #:use-module (guix serialization) - #:use-module ((guix build utils) #:select (mkdir-p)) #:use-module ((guix licenses) #:select (license? license-name)) #:use-module ((guix build syscalls) #:select (free-disk-space terminal-columns)) @@ -79,7 +78,6 @@ read/eval read/eval-package-expression location->string - config-directory fill-paragraph texi->plain-text package-description-string @@ -856,25 +854,6 @@ replacement if PORT is not Unicode-capable." (($ <location> file line column) (format #f "~a:~a:~a" file line column)))) -(define* (config-directory #:key (ensure? #t)) - "Return the name of the configuration directory, after making sure that it -exists if ENSURE? is true. Honor the XDG specs, -<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>." - (let ((dir (and=> (or (getenv "XDG_CONFIG_HOME") - (and=> (getenv "HOME") - (cut string-append <> "/.config"))) - (cut string-append <> "/guix")))) - (catch 'system-error - (lambda () - (when ensure? - (mkdir-p dir)) - dir) - (lambda args - (let ((err (system-error-errno args))) - ;; ERR is necessarily different from EEXIST. - (leave (G_ "failed to create configuration directory `~a': ~a~%") - dir (strerror err))))))) - (define* (fill-paragraph str width #:optional (column 0)) "Fill STR such that each line contains at most WIDTH characters, assuming that the first character is at COLUMN. |