Simplify call-with-temporary-directory.

This commit is contained in:
Ray Miller 2024-07-17 17:25:29 +01:00
parent 522f75ffac
commit 2a8fb2ce5b

View file

@ -52,9 +52,7 @@
(define (call-with-temporary-directory proc) (define (call-with-temporary-directory proc)
"Call PROC with a name of a temporary directory; close the directory and "Call PROC with a name of a temporary directory; close the directory and
delete it when leaving the dynamic extent of this call." delete it when leaving the dynamic extent of this call."
(let* ((directory (or (getenv "TMPDIR") "/tmp")) (let ((tmp-dir (create-temporary-directory)))
(template (string-append directory "/ordo.XXXXXX"))
(tmp-dir (mkdtemp! template)))
(dynamic-wind (dynamic-wind
(const #t) (const #t)
(lambda () (lambda ()