utils: 'current-source-directory' gracefully handles lack of source info.

* guix/utils.scm (current-source-directory): Add case for when FILE-NAME
is #f.
This commit is contained in:
Ludovic Courtès 2016-06-19 22:30:34 +02:00
parent cbbbb7be0f
commit a68d0f6fd5
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -727,9 +727,12 @@ (define-syntax current-source-directory
;; the absolute file name by looking at %LOAD-PATH; doing this at ;; the absolute file name by looking at %LOAD-PATH; doing this at
;; run time rather than expansion time is necessary to allow files ;; run time rather than expansion time is necessary to allow files
;; to be moved on the file system. ;; to be moved on the file system.
(if (string-prefix? "/" file-name) (cond ((not file-name)
(dirname file-name) #f) ;raising an error would upset Geiser users
#`(absolute-dirname #,file-name))) ((string-prefix? "/" file-name)
(dirname file-name))
(else
#`(absolute-dirname #,file-name))))
(_ (_
#f)))))) #f))))))