add collection-file-path and splace collection trees at the file level

original commit: 5f1aa418f30f4df086c85ed18dfc5395468b1638
This commit is contained in:
Matthew Flatt 2010-07-25 10:51:19 -05:00
parent b9de711d8a
commit 546e09e0d9
3 changed files with 13 additions and 17 deletions

View File

@ -39,13 +39,7 @@
(apply build-path p args)))
(define (find-library name . cp)
(let ([dir (with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
(if (null? cp)
(collection-path "mzlib")
(apply collection-path cp)))])
(and dir
(let ([file (build-path dir name)])
(and (file-exists? file) file)))))
(apply collection-file-path name cp))
(define (-call-with-input-file* file thunk . flags)
(let ([p (apply mz:open-input-file file flags)])

View File

@ -38,10 +38,11 @@
"`lib' keyword is not followed by a sequence of string datums"
stx
fn))
(build-path (if (null? (cdr l))
(collection-path "mzlib")
(apply collection-path (cdr l)))
(car l)))]
(apply collection-file-path
(car l)
(if (null? (cdr l))
(list "mzlib")
(cdr l))))]
[else
(raise-syntax-error
#f

View File

@ -78,12 +78,13 @@
(let ([s (cadr p)])
(if (regexp-match? #rx"[./]" s)
s
(string-append s "/main.rkt"))))]
[dir (if (and (null? (cddr p))
(null? (cdr strs)))
(collection-path "mzlib")
(apply collection-path (append (cddr p) (drop-right strs 1))))])
(build-path dir (last strs)))]
(string-append s "/main.rkt"))))])
(apply collection-file-path
(last strs)
(if (and (null? (cddr p))
(null? (cdr strs)))
(list "mzlib")
(append (cddr p) (drop-right strs 1)))))]
[else (error 'runtime-path "unknown form: ~e" p)])))
paths)))