From 4f0b19600ae55b29ce0f515d2e1603172b73f3c4 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 20 Jul 2022 20:25:24 +0530 Subject: utils: Allow specifying parent of temporary directory. * tissue/utils.scm (call-with-temporary-directory): Allow specifying directory in which to create temporary directory. --- tissue/utils.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tissue/utils.scm b/tissue/utils.scm index 84bafa5..59c0b0a 100644 --- a/tissue/utils.scm +++ b/tissue/utils.scm @@ -81,10 +81,10 @@ directory after THUNK returns." thunk (cut chdir original-current-directory)))) -(define (call-with-temporary-directory proc) - "Call PROC with a new temporary directory, and delete it when PROC -returns or exits non-locally." - (let ((temporary-directory (mkdtemp "XXXXXX"))) +(define* (call-with-temporary-directory proc #:optional (parent-directory (getcwd))) + "Call PROC with a new temporary directory in PARENT-DIRECTORY, and +delete it when PROC returns or exits non-locally." + (let ((temporary-directory (mkdtemp (string-append parent-directory "/XXXXXX")))) (dynamic-wind (const #t) (cut proc temporary-directory) (lambda () -- cgit v1.2.3