From 2e530c957eea0b400c959a91885f2616e01b2568 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 22 Apr 2025 21:54:48 +0100 Subject: work/command-line-tool: Handle absent path and location correctly. * ravanan/work/command-line-tool.scm (canonicalize-file-value): Handle absent path and location correctly. --- ravanan/work/command-line-tool.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm index 0d1c592..857987e 100644 --- a/ravanan/work/command-line-tool.scm +++ b/ravanan/work/command-line-tool.scm @@ -220,11 +220,13 @@ actually paths." (define (canonicalize-file-value value) "Canonicalize @code{File} type @var{value} adding missing fields." - (let ((path (or (assoc-ref value "location") - (assoc-ref value "path")))) + (let ((path (or (assoc-ref value "path") + (location->path (assoc-ref value "location")))) + (location (or (assoc-ref value "location") + (string-append "file://" (assoc-ref value "path"))))) ;; Populate all fields of the File type value. `(("class" . "File") - ("location" . ,(string-append "file://" path)) + ("location" . ,location) ("path" . ,path) ("basename" . ,(basename path)) ("nameroot" . ,(file-name-stem path)) -- cgit v1.2.3