always adjust catalogs configuration elements

Pathnames in the list need to be made absolute
"file://" URLs, even if the list has no #f element
to splice the default catalog.
This commit is contained in:
Matthew Flatt 2015-05-03 17:11:58 -07:00
parent 4c10a9efac
commit 78e473f017

View File

@ -67,23 +67,21 @@
[else
(match k
['catalogs
(if (member #f v)
;; Replace #f with default URLs, relative path
;; with absolute path:
(apply append (for/list ([i (in-list v)])
(cond
[(not i) (get-default)]
[(regexp-match? #rx"^[a-z]+://" i)
(list i)]
[else
;; If it doesn't look like a URL, then treat it as
;; a path (potentially relative to the configuration file):
(list
(url->string
(path->url
(simple-form-path
(path->complete-path i (path->complete-path (pkg-dir #t)))))))])))
v)]
;; Replace #f with default URLs, relative path
;; with absolute path:
(apply append (for/list ([i (in-list v)])
(cond
[(not i) (get-default)]
[(regexp-match? #rx"^[a-z]+://" i)
(list i)]
[else
;; If it doesn't look like a URL, then treat it as
;; a path (potentially relative to the configuration file):
(list
(url->string
(path->url
(simple-form-path
(path->complete-path i (path->complete-path (pkg-dir #t)))))))])))]
[_ v])]))
(define (update-pkg-cfg! key val)