From 5d8c6318a2a5cfb845f2c60c64a9bd03c74f42c0 Mon Sep 17 00:00:00 2001 From: bdc Date: Fri, 1 Nov 1996 23:34:47 +0000 Subject: [PATCH] fixed cleanup problem --- scsh/static.scm.in | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scsh/static.scm.in b/scsh/static.scm.in index 87883a2..1e8eadc 100644 --- a/scsh/static.scm.in +++ b/scsh/static.scm.in @@ -190,11 +190,17 @@ For testing load this at a scsh prompt ;;; if directory exists blow it away ;;; useful for repeated runs from within same scsh process (if (file-exists? (options:temp-dir options)) - (if (file-directory? (options:temp-dir otions)) - (with-cwd (options:temp-dir options) - (map delete-file (directory-files - (options:temp-dir options) #t))) - (delete-file (options:temp-dir options)))) + (cond ((file-directory? (options:temp-dir otions)) + (with-cwd (options:temp-dir options) + (let loop ((files (directory-files + (options:temp-dir options) + #t))) + (cond ((not (null? files)) + (delete-file (car files)) + (loop (cdr files)))))) + (delete-directory (options:temp-dir options))) + (else + (delete-file (options:temp-dir options))))) (create-directory (options:temp-dir options) #o755 #t) ;;; Process the info we gather to make it the output file @@ -203,8 +209,11 @@ For testing load this at a scsh prompt (compile-main-c-file start reloc options) (compile-c-image pure impure reloc externs options) (link-files options) - (map delete-file (directory-files + (let loop ((files (directory-files (options:temp-dir options) #t))) + (cond ((not (null? files)) + (delete-file (car files)) + (loop (cdr files)))))) (delete-directory (options:temp-dir options))))) ;;; read-heap-image