about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-04-09 13:45:46 +0100
committerArun Isaac2026-04-09 13:45:46 +0100
commita340ef35649a564647fa5376c005685842dd1478 (patch)
tree5b49a970a87a463d912f694b9821ca607f2701c1
parent5fc3f16dab4613f0d1667646931ce2d0b0cfd3b7 (diff)
downloadkaagum-a340ef35649a564647fa5376c005685842dd1478.tar.gz
kaagum-a340ef35649a564647fa5376c005685842dd1478.tar.lz
kaagum-a340ef35649a564647fa5376c005685842dd1478.zip
Catch and report files that don't exist.
-rw-r--r--kaakaa/tools/base.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/kaakaa/tools/base.scm b/kaakaa/tools/base.scm
index 959640a..895d191 100644
--- a/kaakaa/tools/base.scm
+++ b/kaakaa/tools/base.scm
@@ -30,9 +30,12 @@
                                    #:description "File path to read"
                                    #:required? #t)))
         #:proc (lambda* (#:key path)
-                 ;; TODO: Handle non-existent files.
-                 (display (call-with-input-file path
-                            get-string-all)))
+                 (if (file-exists? path)
+                     (display (call-with-input-file path
+                                get-string-all))
+                     (format (current-output-port)
+                             "Error: File ~a does not exist~%"
+                             path)))
         #:title (lambda* (#:key path)
                   (string-append "Read " path))
         #:kind (const "read")))