commit 7265c614d476a81d649af13bf466d48d362c142c
parent 867af4149a9816f9ad4f0ad023c0aeffceeebe5a
Author: Robby Findler <robby@racket-lang.org>
Date: Sun, 18 Sep 2011 20:35:53 -0500
Change scribble so that is overwrites the destination file when it makes a .pdf file
instead of copying the file into place. This makes Lion's Preview happier (specifically
it now recognizes the file as a revision of the old one and updates itself instead of
treating it as a new file and opening a second window)
original commit: f9e1c41cb0a7f84766207d7a092443dbb5a17e1c
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/collects/scribble/private/indirect-renderer.rkt b/collects/scribble/private/indirect-renderer.rkt
@@ -1,6 +1,7 @@
#lang scheme/base
-(require scheme/class scheme/file scheme/path)
+(require scheme/class scheme/file scheme/path
+ racket/port)
(provide make-indirect-renderer-mixin)
@@ -40,7 +41,11 @@
(convert (file-name-from-path tmp)))
(when (super report-output?) ; use the original
(printf " [Output to ~a]\n" dst))
- (when (file-exists? dst) (delete-file dst))
- (copy-file (build-path tmp-dir (file-name-from-path dst)) dst))
+ (call-with-output-file dst
+ (λ (out-port)
+ (call-with-input-file (build-path tmp-dir (file-name-from-path dst))
+ (λ (in-port)
+ (copy-port in-port out-port))))
+ #:exists 'truncate))
(cleanup)))
(super-new)))