setup/path-relativize: fix for unknown root path

This commit is contained in:
Matthew Flatt 2012-09-22 08:11:08 -06:00
parent c3a454aebf
commit 1eabd154fb

View File

@ -38,7 +38,8 @@
[else (raise-type-error to-rel-name "path, string, or bytes" [else (raise-type-error to-rel-name "path, string, or bytes"
path0)])) path0)]))
(let loop ([path (explode-path path1)] [root (force exploded-root)]) (let loop ([path (explode-path path1)] [root (force exploded-root)])
(cond [(null? root) (cons tag (map (lambda (pe) (datum-intern-literal (path-element->bytes pe))) (cond [(not root) path0]
[(null? root) (cons tag (map (lambda (pe) (datum-intern-literal (path-element->bytes pe)))
path))] path))]
;; Note: in some cases this returns the input path as is, which ;; Note: in some cases this returns the input path as is, which
;; could be a byte string -- it should be possible to return ;; could be a byte string -- it should be possible to return