utils: 'current-source-directory' is now purely an expansion-time thing.
* guix/utils.scm (extract-directory): Remove. (current-source-directory): Rewrite as a 'syntax-case' macro.
This commit is contained in:
parent
762e54b7b4
commit
5dbae738f0
|
@ -702,18 +702,16 @@ output port, and PROC's result is returned."
|
||||||
;;; Source location.
|
;;; Source location.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define (extract-directory properties)
|
(define-syntax current-source-directory
|
||||||
"Extract the directory name from source location PROPERTIES."
|
(lambda (s)
|
||||||
(match (assq 'filename properties)
|
"Return the current directory name or #f if it could not be determined."
|
||||||
(('filename . (? string? file-name))
|
(syntax-case s ()
|
||||||
(dirname file-name))
|
((_)
|
||||||
(_
|
(match (assq 'filename (syntax-source s))
|
||||||
#f)))
|
(('filename . (? string? file-name))
|
||||||
|
(dirname file-name))
|
||||||
(define-syntax-rule (current-source-directory)
|
(_
|
||||||
"Expand to the directory of the current source file or #f if it could not
|
#f))))))
|
||||||
be determined."
|
|
||||||
(extract-directory (current-source-location)))
|
|
||||||
|
|
||||||
;; A source location.
|
;; A source location.
|
||||||
(define-record-type <location>
|
(define-record-type <location>
|
||||||
|
|
Loading…
Reference in New Issue