diff options
| author | Arun Isaac | 2026-04-09 13:45:46 +0100 |
|---|---|---|
| committer | Arun Isaac | 2026-04-09 13:45:46 +0100 |
| commit | a340ef35649a564647fa5376c005685842dd1478 (patch) | |
| tree | 5b49a970a87a463d912f694b9821ca607f2701c1 | |
| parent | 5fc3f16dab4613f0d1667646931ce2d0b0cfd3b7 (diff) | |
| download | kaagum-a340ef35649a564647fa5376c005685842dd1478.tar.gz kaagum-a340ef35649a564647fa5376c005685842dd1478.tar.lz kaagum-a340ef35649a564647fa5376c005685842dd1478.zip | |
Catch and report files that don't exist.
| -rw-r--r-- | kaakaa/tools/base.scm | 9 |
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"))) |
