From 8f7e5b3803e17fd6f0e693be25835cd95d8f6c37 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Wed, 17 Feb 2010 22:04:57 +0000 Subject: [PATCH] Making the atomic renaming truly atomic with an option to rename I didn't realize existed. :'( svn: r18134 --- collects/mzlib/compile.ss | 2 +- collects/unstable/file.ss | 7 +------ collects/unstable/scribblings/file.scrbl | 5 ----- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/collects/mzlib/compile.ss b/collects/mzlib/compile.ss index f2dfd47b06..037170c609 100644 --- a/collects/mzlib/compile.ss +++ b/collects/mzlib/compile.ss @@ -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))) diff --git a/collects/unstable/file.ss b/collects/unstable/file.ss index 2086f3ac69..829a96ba66 100644 --- a/collects/unstable/file.ss +++ b/collects/unstable/file.ss @@ -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)]) \ No newline at end of file + [make-directory*/ignore-exists-exn (path-string? . -> . void)]) \ No newline at end of file diff --git a/collects/unstable/scribblings/file.scrbl b/collects/unstable/scribblings/file.scrbl index b7ccc34408..ef7012d29d 100644 --- a/collects/unstable/scribblings/file.scrbl +++ b/collects/unstable/scribblings/file.scrbl @@ -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. } \ No newline at end of file