From a8fd3cbb6363fd2850c70044c92220c73272a349 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 3 Aug 2015 17:40:19 -0700 Subject: [PATCH] fix current-directory on cache --- render.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/render.rkt b/render.rkt index 2be0133..c9be117 100644 --- a/render.rkt +++ b/render.rkt @@ -205,10 +205,12 @@ (or ; Build the possible paths and use the first one that either exists, or has existing source (template, preproc, or null) (ormap (λ(p) (if (ormap file-exists? (list p (->template-source-path p) (->preproc-source-path p) (->null-source-path p))) p #f)) (filter (λ(x) (->boolean x)) ; if any of the possibilities below are invalid, they return #f - (list + (list + ;; this op touches the cache so set up current-directory correctly + (parameterize ([current-directory (world:current-project-root)]) (let ([source-metas (cached-require source-path (world:current-meta-export))]) (and (hash-has-key? source-metas (->symbol (world:current-template-meta-key))) - (build-path source-dir (select-from-metas (->string (world:current-template-meta-key)) source-metas)))) ; path based on metas + (build-path source-dir (select-from-metas (->string (world:current-template-meta-key)) source-metas))))) ; path based on metas (and (filename-extension output-path) (build-path (world:current-project-root) (add-ext (world:current-default-template-prefix) (get-ext output-path))))))) ; path to default template (and (filename-extension output-path) (build-path (world:current-server-extras-path) (add-ext (world:current-fallback-template-prefix) (get-ext output-path)))))))) ; fallback template