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