slightly more robust way to build the paths

This commit is contained in:
Danny Yoo 2011-10-03 14:10:12 -04:00
parent 0eab74e2e0
commit a254acf05f

View File

@ -118,11 +118,13 @@
(let ([n 0]) (let ([n 0])
(lambda () (lambda ()
(define result (build-path (current-output-dir) (define result (build-path (current-output-dir)
(regexp-replace #rx"[.](rkt|ss)$" (string-append
(path->string (file-name-from-path f)) (regexp-replace #rx"[.](rkt|ss)$"
(if (= n 0) (path->string (file-name-from-path f))
".js" "")
(format "_~a.js" n))))) (if (= n 0)
".js"
(format "_~a.js" n)))))
(set! written-js-paths (cons result written-js-paths)) (set! written-js-paths (cons result written-js-paths))
(set! n (add1 n)) (set! n (add1 n))
(fprintf (current-report-port) (fprintf (current-report-port)
@ -162,14 +164,17 @@
"")] "")]
[output-html-filename [output-html-filename
(build-path (build-path
(regexp-replace #rx"[.](rkt|ss)$" (string-append (regexp-replace #rx"[.](rkt|ss)$"
(path->string (file-name-from-path f)) (path->string (file-name-from-path f))
".html"))] "")
".html"))]
[output-manifest-filename [output-manifest-filename
(build-path (build-path
(regexp-replace #rx"[.](rkt|ss)$" (string-append
(path->string (file-name-from-path f)) (regexp-replace #rx"[.](rkt|ss)$"
".appcache"))]) (path->string (file-name-from-path f))
"")
".appcache"))])
(unless (directory-exists? (current-output-dir)) (unless (directory-exists? (current-output-dir))
(fprintf (current-report-port) "Creating destination directory ~s\n" (current-output-dir)) (fprintf (current-report-port) "Creating destination directory ~s\n" (current-output-dir))
(make-directory* (current-output-dir))) (make-directory* (current-output-dir)))