normalize paths passed to raco

pull/58/head
Matthew Butterick 10 years ago
parent 9655d01967
commit 0117e1a21b

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base pollen/command)) (require (for-syntax racket/base pollen/command racket/path))
;; Handle commands from raco ;; Handle commands from raco
@ -28,13 +28,16 @@
;; which is slow, and needs to happen at the top level. ;; which is slow, and needs to happen at the top level.
(define-syntax (select-syntax-for-command stx) (define-syntax (select-syntax-for-command stx)
(datum->syntax stx (datum->syntax stx
(case arg-command-name ;; normalize-path happens here because it needs filesystem access
[("test" "xyzzy") (handle-test)] ;; (unlike cleanse-path or simplify-path)
[(#f "help") (handle-help)] (let ([first-arg-or-current-dir (normalize-path first-arg-or-current-dir)])
[("start") (handle-start (path->directory-path first-arg-or-current-dir) port-arg)] (case arg-command-name
[("render") (handle-render first-arg-or-current-dir rest-args)] [("test" "xyzzy") (handle-test)]
[("clone") (handle-clone first-arg-or-current-dir rest-args)] [(#f "help") (handle-help)]
[else (handle-else arg-command-name)]))) [("start") (handle-start (path->directory-path first-arg-or-current-dir) port-arg)]
[("render") (handle-render first-arg-or-current-dir rest-args)]
[("clone") (handle-clone first-arg-or-current-dir rest-args)]
[else (handle-else arg-command-name)]))))
(select-syntax-for-command) (select-syntax-for-command)

Loading…
Cancel
Save