Browse Source

pull: Create ~/.config/guix if needed instead of bailing out gracelessly.

Previously 'guix pull' would just fail with "No such file or directory"
if ~/.config didn't already exist.

* guix/ui.scm (config-directory): Use 'mkdir-p' instead of 'mkdir'.
  Change the 'catch' handler to expect errors different from EEXIST.
gn-latest-20200428
Ludovic Courtès 7 years ago
parent
commit
5975881687
  1. 13
      guix/ui.scm

13
guix/ui.scm

@ -25,6 +25,7 @@
#:use-module (guix packages)
#:use-module (guix build-system)
#:use-module (guix derivations)
#:use-module ((guix build utils) #:select (mkdir-p))
#:use-module ((guix licenses) #:select (license? license-name))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
@ -370,15 +371,13 @@ exists. Honor the XDG specs,
(cut string-append <> "/guix"))))
(catch 'system-error
(lambda ()
(mkdir dir)
(mkdir-p dir)
dir)
(lambda args
(match (system-error-errno args)
((or EEXIST 0)
dir)
(err
(leave (_ "failed to create configuration directory `~a': ~a~%")
dir (strerror err))))))))
(let ((err (system-error-errno args)))
;; ERR is necessarily different from EEXIST.
(leave (_ "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

Loading…
Cancel
Save