aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-14 15:33:38 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-14 23:49:02 +0200
commit5975881687edff21251f28c9d1c22fe890268863 (patch)
treea21de732fb49ce868a310895ae98ecfcc61ea899
parent24e752c097c7a5c5f716265ae00d83317e3c7481 (diff)
downloadguix-5975881687edff21251f28c9d1c22fe890268863.tar
guix-5975881687edff21251f28c9d1c22fe890268863.tar.gz
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.
-rw-r--r--guix/ui.scm13
1 files changed, 6 insertions, 7 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index f11c2e9c92..531d922ad9 100644
--- a/guix/ui.scm
+++ b/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