about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-04-22 21:54:48 +0100
committerArun Isaac2025-04-22 22:17:24 +0100
commit2e530c957eea0b400c959a91885f2616e01b2568 (patch)
treefa58fe7d7b1dc3406951e0b113ee355097bb138b
parent28b3b6bc233a0797d16372688d760fe0b2b6fd52 (diff)
downloadravanan-2e530c957eea0b400c959a91885f2616e01b2568.tar.gz
ravanan-2e530c957eea0b400c959a91885f2616e01b2568.tar.lz
ravanan-2e530c957eea0b400c959a91885f2616e01b2568.zip
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.
-rw-r--r--ravanan/work/command-line-tool.scm8
1 files 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))