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
This commit is contained in:
Robby Findler 2011-09-18 20:35:53 -05:00
parent 867af4149a
commit 7265c614d4

View File

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