- with-working-directory directory thunkprocedure
Change to the directory, execute thunk, change back; returns the value of executing thunk.
- directory
- The directory to switch to
- thunk
- The thunk to execute
(define (with-working-directory directory thunk) (let ((original-directory (current-directory))) (dynamic-wind (lambda () (current-directory directory)) thunk (lambda () (current-directory original-directory)))))