diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-11-30 17:17:00 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-11-30 23:50:40 +0100 |
commit | 99c45877a984dd0148151b2e304afef6fb04f1a5 (patch) | |
tree | 39a1e9ff9cbcb619842b6dea70e7efb4126b28c4 /guix/gexp.scm | |
parent | d70478da2b878350450b976686f29712c06745f3 (diff) | |
download | patches-99c45877a984dd0148151b2e304afef6fb04f1a5.tar patches-99c45877a984dd0148151b2e304afef6fb04f1a5.tar.gz |
gexp: 'local-file' properly resolves non-literal relative file names.
* guix/gexp.scm (local-file): Distinguish the case where FILE is a
literal string and when it's not. Add a clause for when FILE is not a
literal string.
* tests/gexp.scm ("local-file, non-literal relative file name"): New test.
* doc/guix.texi (G-Expressions): Update accordingly.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index b640c079e4..a96592ac76 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -320,9 +320,16 @@ It is implemented as a macro to capture the current source directory where it appears." (syntax-case s () ((_ file rest ...) + (string? (syntax->datum #'file)) + ;; FILE is a literal, so resolve it relative to the source directory. #'(%local-file file (delay (absolute-file-name file (current-source-directory))) rest ...)) + ((_ file rest ...) + ;; Resolve FILE relative to the current directory. + #'(%local-file file + (delay (absolute-file-name file (getcwd))) + rest ...)) ((_) #'(syntax-error "missing file name")) (id |