make setup-plt --doc-pdf work right with a relative path

svn: r8134
This commit is contained in:
Matthew Flatt 2007-12-27 11:18:20 +00:00
parent c0872f69ea
commit d6adb5600e

View File

@ -832,37 +832,38 @@
(when (doc-pdf-dest) (when (doc-pdf-dest)
(setup-printf "Building PDF documentation (via pdflatex)") (setup-printf "Building PDF documentation (via pdflatex)")
(unless (directory-exists? (doc-pdf-dest)) (let ([dest-dir (path->complete-path (doc-pdf-dest))])
(make-directory (doc-pdf-dest))) (unless (directory-exists? dest-dir)
(let ([tmp-dir (build-path (find-system-path 'temp-dir) (make-directory dest-dir))
(format "pltpdfdoc~a" (current-seconds)))]) (let ([tmp-dir (build-path (find-system-path 'temp-dir)
(dynamic-wind (format "pltpdfdoc~a" (current-seconds)))])
void (dynamic-wind
(lambda () void
(make-directory tmp-dir) (lambda ()
(doc:verbose (verbose)) (make-directory tmp-dir)
(doc:setup-scribblings (if (and (null? x-specific-collections) (doc:verbose (verbose))
(null? x-specific-planet-dirs)) (doc:setup-scribblings (if (and (null? x-specific-collections)
#f (null? x-specific-planet-dirs))
(map cc-path ccs-to-compile)) #f
tmp-dir) (map cc-path ccs-to-compile))
(parameterize ([current-directory tmp-dir]) tmp-dir)
(for-each (lambda (f) (parameterize ([current-directory tmp-dir])
(when (regexp-match? #rx#"[.]tex$" (path-element->bytes f)) (for-each (lambda (f)
(let loop ([n 3]) (when (regexp-match? #rx#"[.]tex$" (path-element->bytes f))
(unless (zero? n) (let loop ([n 3])
(unless (system (format "pdflatex ~a" f)) (unless (zero? n)
(error 'setup-plt "pdflatex failed")) (unless (system (format "pdflatex ~a" f))
(loop (sub1 n)))) (error 'setup-plt "pdflatex failed"))
(let* ([f (path-replace-suffix f #".pdf")] (loop (sub1 n))))
[target (build-path (doc-pdf-dest) f)]) (let* ([f (path-replace-suffix f #".pdf")]
(when (file-exists? target) [target (build-path dest-dir f)])
(delete-file target)) (when (file-exists? target)
(copy-file f target)))) (delete-file target))
(directory-list)))) (copy-file f target))))
(lambda () (directory-list))))
(when (directory-exists? tmp-dir) (lambda ()
(delete-directory/files tmp-dir)))))) (when (directory-exists? tmp-dir)
(delete-directory/files tmp-dir)))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make Launchers ;; ;; Make Launchers ;;