From d6adb5600ef40a61ff2a7a1d897cbb4a3fd68a89 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 27 Dec 2007 11:18:20 +0000 Subject: [PATCH] make setup-plt --doc-pdf work right with a relative path svn: r8134 --- collects/setup/setup-unit.ss | 63 ++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/collects/setup/setup-unit.ss b/collects/setup/setup-unit.ss index 91c8febbf6..82642ee73b 100644 --- a/collects/setup/setup-unit.ss +++ b/collects/setup/setup-unit.ss @@ -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 ;;