handle the case where the links file contains an absolute path

also try to make fewer assumptions about the content of links files
closes PR 14392
This commit is contained in:
Robby Findler 2014-03-13 14:17:51 -05:00
parent ba55c935d7
commit e3a85115f5

View File

@ -79,14 +79,23 @@
(cond
[link
(define-values (base name dir?) (split-path link))
(if (file-exists? link)
(for/list ([link-ent (call-with-input-file link read)]
#:when (if (= 3 (length link-ent))
(regexp-match (list-ref link-ent 2) (version))
#t))
`(,(list-ref link-ent 0)
,(simplify-path (build-path base (list-ref link-ent 1)))))
'())]
(cond
[(file-exists? link)
(define link-ents (with-handlers ([exn:fail? (λ (x) '())])
(call-with-input-file link read)))
(for/list ([link-ent (if (list? link-ents)
link-ents
'())]
#:when (if (and (list? link-ent) (= 3 (length link-ent)))
(and (regexp? (list-ref link-ent 2))
(regexp-match (list-ref link-ent 2) (version)))
#t))
`(,(list-ref link-ent 0)
,(simplify-path
(if (relative-path? (list-ref link-ent 1))
(build-path base (list-ref link-ent 1))
(list-ref link-ent 1)))))]
[else '()])]
[else
(for/list ([clp (in-list library-collection-paths)])
`(root ,(simplify-path clp)))]))))