From ae4aaefba17fec5031586f564c1954ff0e91b134 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 22 Nov 2020 19:34:57 -0800 Subject: [PATCH] simplify more paths --- pollen/cache.rkt | 2 +- pollen/private/command.rkt | 2 +- pollen/private/file-utils.rkt | 7 +++---- pollen/private/preheat-cache.rkt | 2 +- pollen/private/ts.rktd | 2 +- pollen/render.rkt | 2 +- pollen/setup.rkt | 5 +++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pollen/cache.rkt b/pollen/cache.rkt index 3ac7a29..e622f56 100644 --- a/pollen/cache.rkt +++ b/pollen/cache.rkt @@ -39,7 +39,7 @@ (λ (path-or-path-string subkey caller-name) (define path (with-handlers ([exn:fail? (path-error-handler caller-name path-or-path-string)]) - (path->complete-path (if (path? path-or-path-string) + (simple-form-path (if (path? path-or-path-string) path-or-path-string (string->path path-or-path-string))))) (unless (file-exists? path) diff --git a/pollen/private/command.rkt b/pollen/private/command.rkt index 53182e6..db82168 100644 --- a/pollen/private/command.rkt +++ b/pollen/private/command.rkt @@ -52,7 +52,7 @@ 'pollen)])) (define (very-nice-path x) - (path->complete-path (simplify-path (cleanse-path (->path x))))) + (simple-form-path (cleanse-path (->path x)))) (define (handle-test) (displayln "raco pollen is installed correctly")) diff --git a/pollen/private/file-utils.rkt b/pollen/private/file-utils.rkt index 9127f39..6913c9c 100644 --- a/pollen/private/file-utils.rkt +++ b/pollen/private/file-utils.rkt @@ -19,10 +19,9 @@ (parameterize ([current-directory (dirname (->complete-path starting-path))]) (let loop ([dir (current-directory)][path filename-to-find]) (and dir ; dir is #f when it hits the top of the filesystem - (let ([completed-path (path->complete-path path)]) - (if (exists-proc completed-path) - (simplify-path completed-path) - (loop (dirname dir) (build-path 'up path)))))))) + (match (simple-form-path path) + [(? exists-proc sfp) sfp] + [_ (loop (dirname dir) (build-path 'up path))]))))) ;; for files like svg that are not source in pollen terms, diff --git a/pollen/private/preheat-cache.rkt b/pollen/private/preheat-cache.rkt index 7bbe54e..d669e0d 100644 --- a/pollen/private/preheat-cache.rkt +++ b/pollen/private/preheat-cache.rkt @@ -31,7 +31,7 @@ pagetree-source?))]) (proc path)) #:unless (path-cached? path)) - (path->complete-path path))) + (simple-form-path path))) (cond [wants-dry-run? (for-each message uncached-paths)] diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index e9f0aa1..c573b3a 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1605630343 +1606102497 diff --git a/pollen/render.rkt b/pollen/render.rkt index 19b8c32..17e83a3 100644 --- a/pollen/render.rkt +++ b/pollen/render.rkt @@ -33,7 +33,7 @@ (require racket/runtime-path) (define-runtime-path sample-dir "test/data/samples") (define samples (parameterize ([current-directory sample-dir]) - (map path->complete-path (filter (λ (name) (regexp-match "sample-" name)) (directory-list "."))))) + (map simple-form-path (filter (λ (name) (regexp-match "sample-" name)) (directory-list "."))))) (define-values (sample-01 sample-02 sample-03) (apply values samples))) ;; each key for mod-date-hash is a list of file / mod-date pairs (using pollen/cache keymaking function) diff --git a/pollen/setup.rkt b/pollen/setup.rkt index 93c8e47..5d3fae3 100644 --- a/pollen/setup.rkt +++ b/pollen/setup.rkt @@ -1,6 +1,7 @@ #lang racket/base (require (for-syntax racket/base racket/syntax) racket/runtime-path + racket/path "private/constants.rkt") (provide (all-from-out "private/constants.rkt")) @@ -23,10 +24,10 @@ [(not maybe-dir) (current-directory)] [(directory-exists? maybe-dir) maybe-dir] [else (define dir (dirname maybe-dir)) - (and (not (eq? 'relative dir)) (path->complete-path dir (current-directory)))])) + (and (not (eq? 'relative dir)) (simple-form-path dir (current-directory)))])) (let loop ([dir starting-dir][path default-directory-require]) (and dir ; dir is #f when it hits the top of the filesystem - (let ([simplified-path (simplify-path (path->complete-path path starting-dir))]) + (let ([simplified-path (simple-form-path (path->complete-path path starting-dir))]) (if (file-exists? simplified-path) simplified-path (loop (dirname dir) (build-path 'up path)))))))