make subdir a complete path (closes #228)

pull/232/head
Matthew Butterick 5 years ago
parent cf9b81738a
commit 790c166b5a

@ -1 +1 @@
1592782348 1593668186

@ -1,4 +1,4 @@
#lang racket/base #lang debug racket/base
(require (for-syntax racket/base racket/syntax) (require (for-syntax racket/base racket/syntax)
racket/runtime-path racket/runtime-path
"private/constants.rkt") "private/constants.rkt")
@ -23,7 +23,7 @@
[(not maybe-dir) (current-directory)] [(not maybe-dir) (current-directory)]
[(directory-exists? maybe-dir) maybe-dir] [(directory-exists? maybe-dir) maybe-dir]
[else (define dir (dirname maybe-dir)) [else (define dir (dirname maybe-dir))
(and (not (eq? 'relative dir)) dir)])) (and (not (eq? 'relative dir)) (path->complete-path dir (current-directory)))]))
(let loop ([dir starting-dir][path default-directory-require]) (let loop ([dir starting-dir][path default-directory-require])
(and dir ; dir is #f when it hits the top of the filesystem (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 (simplify-path (path->complete-path path starting-dir))])

@ -0,0 +1,12 @@
#lang at-exp racket/base
(require rackunit
racket/runtime-path
pollen/file)
(define-runtime-path example "data/ext/example.html")
(define-runtime-path example-pm "data/ext/example.html.pm")
(define-runtime-path another "data/ext/sub/another.html")
(define-runtime-path another-pm "data/ext/sub/another.html.pm")
(check-equal? (get-markup-source example) example-pm)
(check-equal? (get-markup-source another) another-pm)
Loading…
Cancel
Save