world settables can use file or dir path

pull/102/head
Matthew Butterick 9 years ago
parent a42acbf2e6
commit cad3e25f96

@ -146,10 +146,8 @@
(when (not (file-exists? path))
(error (format "cached-require: ~a does not exist" path)))
(define-values (path-dir path-name _) (split-path path))
(cond
[(world:current-compile-cache-active path-dir)
[(world:current-compile-cache-active path)
(define key (paths->key path))
(hash-ref (hash-ref! ram-cache key (λ _
(cache-ref! key (λ _ (path->hash path))))) subkey)]

@ -96,8 +96,7 @@
(cond
[(not (file-exists? output-path)) 'file-missing]
[(mod-date-missing-or-changed? source-path template-path) 'mod-key-missing-or-changed]
[(let-values ([(source-dir source-name _) (split-path source-path)])
(not (world:current-render-cache-active source-dir))) 'render-cache-deactivated]
[(not (world:current-render-cache-active source-path)) 'render-cache-deactivated]
[else #f]))

@ -8,14 +8,12 @@
(define directory-require "pollen.rkt")
(define (get-path-to-override [starting-dir (current-directory)])
;; for now, let `path->complete-path` flag any argument errors (test here is redundant)
#;(when (or (not (path? starting-dir)) (not (directory-exists? starting-dir)))
(error 'get-path-to-override (format "~a is not a directory" starting-dir)))
(define (get-path-to-override [file-or-dir (current-directory)])
(define file-with-config-submodule directory-require)
(define (dirname path)
(let-values ([(dir name dir?) (split-path path)])
dir))
(define starting-dir (if (directory-exists? file-or-dir) file-or-dir (dirname file-or-dir)))
(let loop ([dir starting-dir][path file-with-config-submodule])
(and dir ; dir is #f when it hits the top of the filesystem
(let ([completed-path (path->complete-path path starting-dir)])

Loading…
Cancel
Save