.
original commit: 36d18d53b11729130a2bf4e0ec5331218de4ebb8
This commit is contained in:
parent
46f807da86
commit
3ffe36238f
|
@ -263,13 +263,12 @@
|
||||||
(or f
|
(or f
|
||||||
(let ([f (let ([v (with-handlers ([not-break-exn? (lambda (x) null)])
|
(let ([f (let ([v (with-handlers ([not-break-exn? (lambda (x) null)])
|
||||||
(let ([pref-file (let ([f (find-system-path 'pref-file)])
|
(let ([pref-file (let ([f (find-system-path 'pref-file)])
|
||||||
;; BUG: f might not exist because it's being
|
|
||||||
;; updated --- unlikely, but possible. Also, there's
|
|
||||||
;; a race condition between this test and the read
|
|
||||||
;; below.
|
|
||||||
(if (file-exists? f)
|
(if (file-exists? f)
|
||||||
|
;; Using `file-exists?' means there's technically
|
||||||
|
;; a race condition, but something
|
||||||
|
;; has gone really wrong if the file disappears.
|
||||||
f
|
f
|
||||||
;; Error bails out through above `with-handlers'
|
;; Error here bails out through above `with-handlers'
|
||||||
(build-path (collection-path "defaults")
|
(build-path (collection-path "defaults")
|
||||||
"plt-prefs.ss")))])
|
"plt-prefs.ss")))])
|
||||||
(with-input-from-file pref-file
|
(with-input-from-file pref-file
|
||||||
|
@ -304,8 +303,8 @@
|
||||||
(if m
|
(if m
|
||||||
(cadr m)
|
(cadr m)
|
||||||
(fail-thunk))))]
|
(fail-thunk))))]
|
||||||
[(name fail-thunk) (get-preference name fail-thunk #f)]
|
[(name fail-thunk) (get-preference name fail-thunk #t)]
|
||||||
[(name) (get-preference name (lambda () #f) #f)]))
|
[(name) (get-preference name (lambda () #f) #t)]))
|
||||||
|
|
||||||
(define put-preferences
|
(define put-preferences
|
||||||
(case-lambda
|
(case-lambda
|
||||||
|
@ -360,7 +359,7 @@
|
||||||
(printf ")~n")))
|
(printf ")~n")))
|
||||||
'truncate/replace)
|
'truncate/replace)
|
||||||
(delete-file pref-file)
|
(delete-file pref-file)
|
||||||
(rename-file-or-directory tmp-file pref-file))))
|
(rename-file-or-directory tmp-file pref-file #t))))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
;; Release lock:
|
;; Release lock:
|
||||||
(delete-file lock-file)))))]
|
(delete-file lock-file)))))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user