Changed default value of *temp-file-template*: First $TMPDIR is

consulted, if it is unset we use "/var/tmp".
This commit is contained in:
mainzelm 2001-10-23 08:07:53 +00:00
parent 5e3f793326
commit d6a7f7c303
1 changed files with 16 additions and 3 deletions

View File

@ -175,7 +175,7 @@
;;; The thread-specific resource: A thread fluid ;;; The thread-specific resource: A thread fluid
(define $resource 'emtpy-resource-value) (define $resource 'empty-resource-value)
(define (thread-read-resource) (thread-fluid $resource)) (define (thread-read-resource) (thread-fluid $resource))
(define (thread-set-resource! dir) (set-thread-fluid! $resource dir)) (define (thread-set-resource! dir) (set-thread-fluid! $resource dir))
@ -460,9 +460,22 @@
(list (string-append (constant-format-string (car maybe-prefix)) (list (string-append (constant-format-string (car maybe-prefix))
".~a")))))) ".~a"))))))
(define *temp-file-template* (define (initial-temp-file)
(make-fluid (string-append "/tmp/" (number->string (pid)) ".~a"))) (let ((tmpdir (getenv "TMPDIR")))
(string-append
(if tmpdir
tmpdir
"/var/tmp")
"/"
(number->string (pid))
"~a")))
(define *temp-file-template* (make-fluid 'not-initialized-temp-file-template))
(define temp-file-reinitializer
(make-reinitializer
(lambda ()
(set-fluid! *temp-file-template* (initial-temp-file)))))
(define (temp-file-iterate maker . maybe-template) (define (temp-file-iterate maker . maybe-template)
(let ((template (:optional maybe-template (fluid *temp-file-template*)))) (let ((template (:optional maybe-template (fluid *temp-file-template*))))