summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-19 22:30:34 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-20 00:52:53 +0200
commita68d0f6fd5a93dc80fe9d919413f5d3e8db2a5b4 (patch)
tree3595242a64446bdbad8a711978cde431f454e8e1 /guix/utils.scm
parentcbbbb7be0fbaa11ff75bce92f2d82131ff8db104 (diff)
downloadgnu-guix-a68d0f6fd5a93dc80fe9d919413f5d3e8db2a5b4.tar
gnu-guix-a68d0f6fd5a93dc80fe9d919413f5d3e8db2a5b4.tar.gz
utils: 'current-source-directory' gracefully handles lack of source info.
* guix/utils.scm (current-source-directory): Add case for when FILE-NAME is #f.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm9
1 files 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 @@ be determined."
;; 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))))))