how to convert encoded path to something build-path can use?

32 views
Skip to first unread message

Stephen Chang

unread,
May 21, 2021, 11:35:20 AM5/21/21
to Racket Users
Hi,

It seems that, since 8.1, the format of paths in links.rktd has changed?

Are there new API fns that deal with this new kind of encoded path? Or
what is the recommended way to process them?

Something like this? (Is this `decode-link-path` public? I couldnt find it)
https://github.com/racket/racket/commit/2ac7e21ad422ee322daa4a7e0db318f9b72b6c48#diff-51453f6da842dc20af8fe776f54ec99dd15f4f8b7e9e73cd5d45cdeb96e40ef6R49-R52

I used to pass the paths directly to `build-path` but now it no longer
works. Here's an example error:

build-path: contract violation
expected: (or/c path-string? path-for-some-system? 'up 'same)
given: '(up up #"pkgs" #"racket-lib")

Any recommendations would be appreciated. Thanks!
Steve

Matthew Flatt

unread,
May 21, 2021, 11:50:22 AM5/21/21
to Stephen Chang, Racket Users
Yes, the format changed in that commit.

The `decode-link-path` function is not meant to be public, although it
could be exposed. But for an approach that works now and with older
versions, the API you want is `links` from `setup/link`, possibly like
this:

(links #:file (find-links-file) #:with-path? #t)
(links #:file (find-links-file) #:root? #t)

Stephen Chang

unread,
May 21, 2021, 5:58:15 PM5/21/21
to Matthew Flatt, Racket Users
Thanks!

We were previously manually processing the files from
current-library-collection-links, but using `links` saves ~100 lines
of code.
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20210521095016.3e9%40sirmail.smtps.cs.utah.edu.
Reply all
Reply to author
Forward
0 new messages