ignore pollen cache files when making automatic pagetree (addresses #78)

pull/84/head
Matthew Butterick 10 years ago
parent a8fd3cbb63
commit 92d4a7fef4

@ -77,8 +77,15 @@
;; put subdirs in list ahead of files (so they appear at the top) ;; put subdirs in list ahead of files (so they appear at the top)
(append (sort-names subdirectories) (sort-names pagetree-sources) (sort-names other-files))) (append (sort-names subdirectories) (sort-names pagetree-sources) (sort-names other-files)))
;; in general we don't filter the directory list for the automatic pagetree.
;; this can be annoying sometimes but it's consistent with the policy of avoiding magic behavior.
;; certain files (leading dot) will be ignored by `directory-list` anyhow.
;; we will, however, ignore Pollen's cache files, because those shouldn't be project-manipulated.
(define (not-pollen-cache? path)
(not (member (->string path) world:cache-names)))
(if (directory-exists? dir ) (if (directory-exists? dir )
(decode-pagetree (map ->symbol (unique-sorted-output-paths (directory-list dir)))) (decode-pagetree (map ->symbol (unique-sorted-output-paths (filter not-pollen-cache? (directory-list dir)))))
(error (format "directory->pagetree: directory ~a doesn't exist" dir)))) (error (format "directory->pagetree: directory ~a doesn't exist" dir))))
;; Try loading from pagetree file, or failing that, synthesize pagetree. ;; Try loading from pagetree file, or failing that, synthesize pagetree.

@ -45,6 +45,7 @@
(define-settable cache-filename "pollen.cache") (define-settable cache-filename "pollen.cache")
(define-settable cache-dir-name "pollen-cache") (define-settable cache-dir-name "pollen-cache")
(define cache-names (list (current-cache-filename) (current-cache-dir-name)))
(define-settable decodable-extensions (list (current-markup-source-ext) (current-pagetree-source-ext))) (define-settable decodable-extensions (list (current-markup-source-ext) (current-pagetree-source-ext)))

Loading…
Cancel
Save