From 021eac1949cf590c03e5648bbbb8f10478190d80 Mon Sep 17 00:00:00 2001 From: w6vvn Date: Tue, 9 Sep 2025 17:36:39 -0700 Subject: [PATCH] implement rm command --- palps.rkt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/palps.rkt b/palps.rkt index 25d99ad..879099e 100755 --- a/palps.rkt +++ b/palps.rkt @@ -112,10 +112,21 @@ (flush-output)] [(list _ "ed" name) - (let ([path (if (file-exists? name) - (ed (our-make-temporary-file name)) - (ed))]) - (copy-file path name #:exists-ok? #t))] + (let ([path (build-path (current-directory) + (string->path-element name))]) + (let ([path (if (file-exists? path) + (ed (our-make-temporary-file path)) + (ed))]) + (copy-file path name #:exists-ok? #t)))] + + [(list _ "rm" name) + (let ([path (build-path (current-directory) + (string->path-element name))]) + (if (file-exists? path) + (delete-file path) + (displayln "file does not exist")) + + (flush-output))] [(or (list _ "bye" _) (list _ "b" _)