raco pollen render: use first dir as project root (fixes #172)

pull/174/head
Matthew Butterick 7 years ago
parent f5b44bd337
commit 829bf2b421

@ -94,15 +94,16 @@ version print the version" (current-server-port) (make-publish-di
(define path-args (if (empty? parsed-args) (define path-args (if (empty? parsed-args)
(list (current-directory)) (list (current-directory))
parsed-args)) parsed-args))
(parameterize ([current-directory (current-project-root)] (parameterize ([current-poly-target (render-target-wanted)]) ;; applies to both cases
[current-poly-target (render-target-wanted)]) (cond
;; special case: one directory as argument ;; directory mode: one directory as argument
(if (and (= 1 (length path-args)) (directory-exists? (car path-args))) [(and (= 1 (length path-args)) (directory-exists? (car path-args)))
(let render-one-dir ([dir (->complete-path (car path-args))]) (define top-dir (very-nice-path (car path-args)))
(let render-one-dir ([dir top-dir])
(parameterize ([current-directory dir] (parameterize ([current-directory dir]
[current-project-root (case (render-with-subdirs?) [current-project-root (if (eq? (render-with-subdirs?) 'recursive)
[(recursive) dir] dir
[else (current-project-root)])]) top-dir)])
(define dirlist (directory-list dir)) (define dirlist (directory-list dir))
(define preprocs (filter preproc-source? dirlist)) (define preprocs (filter preproc-source? dirlist))
(define static-pagetrees (filter pagetree-source? dirlist)) (define static-pagetrees (filter pagetree-source? dirlist))
@ -122,10 +123,10 @@ version print the version" (current-server-port) (make-publish-di
(for ([path (in-list dirlist)] (for ([path (in-list dirlist)]
#:when (and (directory-exists? path) #:when (and (directory-exists? path)
(not (omitted-path? path)))) (not (omitted-path? path))))
(render-one-dir (->complete-path path)))))) (render-one-dir (->complete-path path))))))]
(begin [else ;; path mode
(displayln (format "rendering ~a" (string-join (map ->string path-args) " "))) (displayln (format "rendering ~a" (string-join (map ->string path-args) " ")))
(apply render-batch path-args))))) (apply render-batch path-args)])))
(define (handle-start) (define (handle-start)

@ -1 +1 @@
1520467035 1521073365

Loading…
Cancel
Save