From a68d0f6fd5a93dc80fe9d919413f5d3e8db2a5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 19 Jun 2016 22:30:34 +0200 Subject: [PATCH] utils: 'current-source-directory' gracefully handles lack of source info. * guix/utils.scm (current-source-directory): Add case for when FILE-NAME is #f. --- guix/utils.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/guix/utils.scm b/guix/utils.scm index 0e20be3c18..69f4e78a85 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -727,9 +727,12 @@ (define-syntax current-source-directory ;; the absolute file name by looking at %LOAD-PATH; doing this at ;; run time rather than expansion time is necessary to allow files ;; to be moved on the file system. - (if (string-prefix? "/" file-name) - (dirname file-name) - #`(absolute-dirname #,file-name))) + (cond ((not file-name) + #f) ;raising an error would upset Geiser users + ((string-prefix? "/" file-name) + (dirname file-name)) + (else + #`(absolute-dirname #,file-name)))) (_ #f))))))