Making the atomic renaming truly atomic with an option to rename I didn't realize existed. :'(

svn: r18134
This commit is contained in:
Jay McCarthy 2010-02-17 22:04:57 +00:00
parent c2bfa60e31
commit 8f7e5b3803
3 changed files with 2 additions and 12 deletions

View File

@ -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)))

View File

@ -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)])

View File

@ -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.
}