fix module-path-index->taglet bug that is mainly exposed when the current directory is a root directory

svn: r10231
This commit is contained in:
Matthew Flatt 2008-06-12 13:39:23 +00:00
parent 20fcb6314c
commit 64147e45ab
2 changed files with 11 additions and 5 deletions

View File

@ -104,7 +104,7 @@
;; Derive the name from the module path: ;; Derive the name from the module path:
(let ([p (collapse-module-path-index (let ([p (collapse-module-path-index
mod mod
(current-directory))]) (build-path (current-directory) "dummy"))])
(if (path? p) (if (path? p)
;; If we got a path back anyway, then it's best to use the resolved ;; If we got a path back anyway, then it's best to use the resolved
;; name; if the current directory has changed since we ;; name; if the current directory has changed since we

View File

@ -45,11 +45,18 @@
(define (combine-relative-elements elements) (define (combine-relative-elements elements)
(define (extract-base relto)
(let-values ([(base n d?) (split-path relto)])
(if (eq? base 'relative)
'same
(if (not base)
relto ; strange case: relto is a root directory
base))))
;; Used for 'file paths, so it's platform specific: ;; Used for 'file paths, so it's platform specific:
(define (attach-to-relative-path relto) (define (attach-to-relative-path relto)
(apply build-path (apply build-path
(let-values ([(base n d?) (split-path relto)]) (extract-base relto)
(if (eq? base 'relative) 'same base))
(map (lambda (i) (if (bytes? i) (bytes->path i) i)) (map (lambda (i) (if (bytes? i) (bytes->path i) i))
elements))) elements)))
@ -58,8 +65,7 @@
(cond (cond
[(or (path? relto-mp) (and (string? relto-mp) (ormap path? elements))) [(or (path? relto-mp) (and (string? relto-mp) (ormap path? elements)))
(apply build-path (apply build-path
(let-values ([(base name dir?) (split-path relto-mp)]) (extract-base relto-mp)
(if (eq? base 'relative) 'same base))
(map (lambda (x) (if (bytes? x) (bytes->path x) x)) (map (lambda (x) (if (bytes? x) (bytes->path x) x))
elements))] elements))]
[(string? relto-mp) [(string? relto-mp)