Put cwd in a record to be able to define a resumer that initializes to
process-cwd.
This commit is contained in:
parent
8c7c9c2006
commit
d130f23f0d
|
@ -292,10 +292,10 @@
|
|||
|
||||
(define-record-resumer type/cache
|
||||
(lambda (cache)
|
||||
(set-cache:cwd cache ""))) ; set the cache to an impossible filename.
|
||||
(set-cache:cwd cache (process-cwd)))) ; set the cache to an impossible filename.
|
||||
|
||||
(define *unix-cwd*
|
||||
(make-cache "")) ; Initialise the cache to an impossible filename.
|
||||
(make-cache (process-cwd))) ; Initialise the cache to an impossible filename.
|
||||
|
||||
(define (unix-cwd)
|
||||
(cache:cwd *unix-cwd*))
|
||||
|
@ -325,12 +325,19 @@
|
|||
result))))
|
||||
|
||||
;;; The thread-specific CWD: A fluid
|
||||
(define $cwd (make-fluid (process-cwd)))
|
||||
(define-record state
|
||||
cwd)
|
||||
|
||||
(define (cwd) (fluid $cwd))
|
||||
(define (set-cwd! dir) (set-fluid! $cwd dir))
|
||||
(define-record-resumer type/state
|
||||
(lambda (state)
|
||||
(set-state:cwd state (make-fluid (process-cwd)))))
|
||||
|
||||
(define $cwd (make-state (make-fluid (process-cwd))))
|
||||
|
||||
(define (cwd) (fluid (state:cwd $cwd)))
|
||||
(define (set-cwd! dir) (set-fluid! (state:cwd $cwd) dir))
|
||||
(define (let-cwd dir thunk)
|
||||
(let-fluid $cwd dir thunk))
|
||||
(let-fluid (state:cwd $cwd) dir thunk))
|
||||
|
||||
(define (with-cwd* dir thunk)
|
||||
(let ((changed-dir #f))
|
||||
|
|
Loading…
Reference in New Issue