use path-replace-suffix

svn: r2994
This commit is contained in:
Eli Barzilay 2006-05-21 04:09:00 +00:00
parent 2c22b8910a
commit a4c9f75399

View File

@ -32,12 +32,6 @@
(render)
(with-output-to-file output render 'truncate))))
(define (no-suffix file)
(cond [(regexp-match #rx"^(.*)[.](?:[^./]*)$"
(if (path? file) (path->string file) file))
=> cadr]
[else file]))
(provide main)
(define (main args)
(define *output-name #f)
@ -60,8 +54,8 @@
(regexp-match #rx"[.]([^.]+)$" *output-name))
=> (lambda (m) (string->symbol (cadr m)))]
[else default-format])]
[output (or *output-name
(format "~a.~a" (no-suffix input-file) fmt))])
[output (or *output-name (path-replace-suffix
input-file (symbol->string fmt)))])
(render-file input-file output fmt))]))
(main (cons (symbol->string exe-name)