fix temp file names when building PDFs of installed docs

Closes PR 11830

original commit: 192c56629434524ddc29a2f551094363cb8b7ab1
This commit is contained in:
Matthew Flatt 2011-04-14 12:40:18 -06:00
parent 1f3a00eec7
commit 334060a553

View File

@ -22,7 +22,8 @@
[prefix-file #f] [prefix-file #f]
[style-file #f] [style-file #f]
[style-extra-files null] [style-extra-files null]
[extra-files null]) [extra-files null]
[helper-file-prefix #f])
(define/public (current-render-mode) (define/public (current-render-mode)
'()) '())
@ -567,14 +568,15 @@
(define/public (auto-extra-files-paths v) null) (define/public (auto-extra-files-paths v) null)
(define/public (install-extra-files ds) (define/public (install-extra-files ds)
(for ([fn extra-files]) (install-file fn)) (for ([fn extra-files]) (install-file fn #:private-name? #f))
(unless prefix-file (unless prefix-file
(for ([d (in-list ds)]) (for ([d (in-list ds)])
(let ([extras (ormap (lambda (v) (and (auto-extra-files? v) v)) (let ([extras (ormap (lambda (v) (and (auto-extra-files? v) v))
(style-properties (part-style d)))]) (style-properties (part-style d)))])
(when extras (when extras
(for ([fn (in-list (auto-extra-files-paths extras))]) (for ([fn (in-list (auto-extra-files-paths extras))])
(install-file (main-collects-relative->path fn)))))))) (install-file (main-collects-relative->path fn)
#:private-name? #f)))))))
(define/public (render ds fns ri) (define/public (render ds fns ri)
;; maybe this should happen even if fns is empty or all #f? ;; maybe this should happen even if fns is empty or all #f?
@ -699,7 +701,7 @@
(define copied-srcs (make-hash)) (define copied-srcs (make-hash))
(define copied-dests (make-hash)) (define copied-dests (make-hash))
(define/public (install-file fn [content #f]) (define/public (install-file fn [content #f] #:private-name? [private-name? #t])
(if (and refer-to-existing-files (if (and refer-to-existing-files
(not content)) (not content))
(if (string? fn) (if (string? fn)
@ -712,7 +714,12 @@
[dest-dir (get-dest-directory #t)] [dest-dir (get-dest-directory #t)]
[fn (file-name-from-path fn)]) [fn (file-name-from-path fn)])
(let ([src-file (build-path (or src-dir (current-directory)) fn)] (let ([src-file (build-path (or src-dir (current-directory)) fn)]
[dest-file (build-path (or dest-dir (current-directory)) fn)] [dest-file (build-path (or dest-dir (current-directory))
(if (and private-name?
helper-file-prefix)
(string-append helper-file-prefix
(path-element->string fn))
fn))]
[next-file-name (lambda (dest) [next-file-name (lambda (dest)
(let-values ([(base name dir?) (split-path dest)]) (let-values ([(base name dir?) (split-path dest)])
(build-path (build-path