diff --git a/pollen/cache.rkt b/pollen/cache.rkt index a8e1340..75be8ed 100644 --- a/pollen/cache.rkt +++ b/pollen/cache.rkt @@ -16,8 +16,7 @@ #:when (and (directory-exists? path) (let* ([last (compose1 car reverse)] [last-path-element (path->string (last (explode-path path)))]) - (or (equal? last-path-element (setup:cache-dir-name)) - (equal? last-path-element "compiled"))))) + (member last-path-element default-cache-names)))) (message (format "removing cache directory: ~a" path)) (delete-directory/files path))) diff --git a/pollen/pagetree.rkt b/pollen/pagetree.rkt index 99ca641..6b76c14 100644 --- a/pollen/pagetree.rkt +++ b/pollen/pagetree.rkt @@ -93,13 +93,13 @@ ;; certain files (leading dot) will be ignored by `directory-list` anyhow. ;; we will, however, ignore Pollen's cache files, and Racket's `compiled` dirs, ;; because those shouldn't be project-manipulated. - (define (neither-compiled-nor-cache-dir? path) - (not (member (->string path) (cons "compiled" default-cache-names)))) + (define (not-cache-dir? path) + (not (member (->string path) default-cache-names))) (unless (directory-exists? dir) (error 'directory->pagetree (format "directory ~v doesn't exist" dir))) - (decode-pagetree (map ->pagenode (unique-sorted-output-paths (filter neither-compiled-nor-cache-dir? (directory-list dir)))))) + (decode-pagetree (map ->pagenode (unique-sorted-output-paths (filter not-cache-dir? (directory-list dir)))))) (define+provide/contract (get-pagetree source-path) diff --git a/pollen/private/cache-utils.rkt b/pollen/private/cache-utils.rkt index 304e377..d9804f6 100644 --- a/pollen/private/cache-utils.rkt +++ b/pollen/private/cache-utils.rkt @@ -63,7 +63,7 @@ (define (make-cache-dirs path) (define path-dir (dirname path)) - (define cache-dir (build-path path-dir (setup:cache-dir-name))) + (define cache-dir (build-path path-dir (setup:cache-dir-name) (setup:cache-subdir-name))) (define private-cache-dir (build-path cache-dir "private")) (my-make-directory* private-cache-dir) ; will also make cache-dir, if needed (values cache-dir private-cache-dir)) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index 378e4ab..509d359 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1476735877 +1479757388 diff --git a/pollen/scribblings/cache.scrbl b/pollen/scribblings/cache.scrbl index 9ffc729..7885085 100644 --- a/pollen/scribblings/cache.scrbl +++ b/pollen/scribblings/cache.scrbl @@ -11,7 +11,7 @@ The slowest part of a Pollen @racket[render] is compiling a source file. Because Pollen allows source files to be edited and previewed dynamically, these files get recompiled a lot. Therefore, Pollen stores copies of the exports of source files — namely, whatever is stored in @code[(format "~a" default-main-export)] and @code[(format "~a" default-meta-export)] — in a cache so they can be reused. -In each directory of your project, Pollen creates a subdirectory called @filepath{pollen-cache}. The files are stored on disk so they can be reused between sessions. If you delete files within a cache directory (or the whole thing), don't worry — everything will get regenerated. (However, you should not read or write to any @filepath{pollen-cache} directory, as the implementation details are subject to change.) +In each directory of your project, Pollen writes cache files into a subdirectory called @filepath{compiled}. The files are stored on disk so they can be reused between sessions. If you delete files within a cache directory (or the whole thing), don't worry — everything will get regenerated. (However, I don't recommend trying to read or write directly to any @filepath{compiled} directory, as the implementation details of the cache are subject to change.) @section{Preloading and reseting} diff --git a/pollen/setup.rkt b/pollen/setup.rkt index 9915205..22ca6e2 100644 --- a/pollen/setup.rkt +++ b/pollen/setup.rkt @@ -60,9 +60,10 @@ (define+provide default-mode-pagetree 'ptree) (define+provide default-mode-template 'template) -(define-settable cache-filename "pollen.cache") -(define-settable cache-dir-name "pollen-cache") -(define+provide default-cache-names (list (cache-filename) (cache-dir-name))) +(define-settable old-cache-names '("pollen.cache" "pollen-cache")) +(define-settable cache-dir-name "compiled") +(define-settable cache-subdir-name "pollen") +(define+provide default-cache-names (list* (cache-dir-name) (old-cache-names))) (define-settable decodable-extensions (list (markup-source-ext) (pagetree-source-ext))) diff --git a/pollen/test/test-pathup.rkt b/pollen/test/test-pathup.rkt index a796696..1c812ae 100644 --- a/pollen/test/test-pathup.rkt +++ b/pollen/test/test-pathup.rkt @@ -7,8 +7,8 @@ (define-runtime-path dr-sub "data/pathup/subdir/subdir/pollen.rkt") (define-runtime-path template "data/pathup/subdir/template.html") -(define-runtime-path cache-dir "data/pathup/subdir/pollen-cache") -(define-runtime-path other-cache-dir "data/pathup/subdir/subdir/pollen-cache") +(define-runtime-path cache-dir "data/pathup/subdir/compiled") +(define-runtime-path other-cache-dir "data/pathup/subdir/subdir/compiled") (define-runtime-path up-pollen "pollen.rkt") (define-runtime-path test-pathup.rkt "test-pathup.rkt") diff --git a/pollen/test/test-rerequire.rkt b/pollen/test/test-rerequire.rkt index 2e3cacd..7d91e08 100644 --- a/pollen/test/test-rerequire.rkt +++ b/pollen/test/test-rerequire.rkt @@ -9,7 +9,7 @@ (define-runtime-path template.txt "data/rerequire/template.txt") (define-runtime-path markup.txt.pm "data/rerequire/markup.txt.pm") (define-runtime-path markup.txt "data/rerequire/markup.txt") -(define-runtime-path pollen-cache "data/rerequire/pollen-cache") +(define-runtime-path pollen-cache "data/rerequire/compiled") (copy-file markup.txt.pm pre.txt.pp #t)