Making the atomic renaming truly atomic with an option to rename I didn't realize existed. :'(
svn: r18134
This commit is contained in:
parent
c2bfa60e31
commit
8f7e5b3803
|
@ -56,7 +56,7 @@
|
|||
(close-output-port out)))))
|
||||
(lambda ()
|
||||
(if ok?
|
||||
(rename-file-or-directory/ignore-exists-exn temp-filename dest)
|
||||
(rename-file-or-directory temp-filename dest #t)
|
||||
(with-handlers ([exn:fail:filesystem? void])
|
||||
(delete-file temp-filename))))))
|
||||
(lambda () (close-input-port in)))
|
||||
|
|
|
@ -15,10 +15,5 @@
|
|||
(with-handlers ([exn:fail:filesystem:exists? void])
|
||||
(make-directory dir)))))
|
||||
|
||||
(define (rename-file-or-directory/ignore-exists-exn from to)
|
||||
(with-handlers ([exn:fail:filesystem:exists? void])
|
||||
(rename-file-or-directory from to)))
|
||||
|
||||
(provide/contract
|
||||
[make-directory*/ignore-exists-exn (path-string? . -> . void)]
|
||||
[rename-file-or-directory/ignore-exists-exn (path-string? path-string? . -> . void)])
|
||||
[make-directory*/ignore-exists-exn (path-string? . -> . void)])
|
|
@ -16,9 +16,4 @@
|
|||
@defproc[(make-directory*/ignore-exists-exn [pth path-string?])
|
||||
void]{
|
||||
Like @scheme[make-directory*], except it ignores errors when the path already exists. Useful to deal with race conditions on processes that create directories.
|
||||
}
|
||||
|
||||
@defproc[(rename-file-or-directory/ignore-exists-exn [from path-string?] [to path-string?])
|
||||
void]{
|
||||
Like @scheme[rename-file-or-directory], except it ignores errors when the path already exists. Useful to deal with race conditions on processes that create files.
|
||||
}
|
Loading…
Reference in New Issue
Block a user