6.7 API for Paths Relative to "collects"

► |  | raco: Racket Command-Line Tools

1 | raco make: Compiling Source to Bytecode
2 | raco exe: Creating Stand-Alone Executables
3 | raco distribute: Sharing Stand-Alone Executables
4 | raco pack: Packaging Library Collections
5 | raco planet: Automatic Package Distribution
6 | raco setup: Installation Management
7 | raco decompile: Decompiling Bytecode
8 | raco ctool: Working with C Code
9 | Adding a raco Command

▼ | 6 | raco setup: Installation Management

6.1 | Running raco setup
6.2 | "info.rkt" File Format
6.3 | API for Installation
6.4 | API for Installing ".plt" Archives
6.5 | API for Finding Installation Directories
6.6 | API for Reading "info.rkt" Files
6.7 | API for Paths Relative to "collects"
6.8 | API for Cross-References for Installed Manuals

On this page:

path->main-collects-relative
main-collects-relative->path

top← prev up next →

#### 6.7`` API for Paths Relative to "collects"

( require setup/main-collects)

( path->main-collects-relative path)
→ ( or/c path? ( cons/c 'collects ( listof bytes?)))
path : ( or/c bytes? path-string?)

Checks whether path has a prefix that matches the prefix to the main "collects" directory as determined by ( find-collects-dir). If so, the result is a list starting with 'collects and containing the remaining path elements as byte strings. If not, the path is returned as-is.

The path argument should be a complete path. Applying simplify-path before path->main-collects-relative is usually a good idea.

For historical reasons, path can be a byte string, which is converted to a path using bytes->path.

( main-collects-relative->path rel) → path?

rel

:

( or/c bytes? path-string?
( cons/c 'collects
( or/c ( listof bytes?) bytes?)))

The inverse of path->main-collects-relative: if rel is a pair that starts with 'collects, then it is converted back to a path relative to ( find-collects-dir).

For historical reasons, a single byte string is allowed in place of a list of byte strings after 'collects, in which case it is assumed to be a relative path after conversion with bytes->path.

Also for historical reasons, if rel is any kind of value other than specified in the contract above, it is returned as-is.

top← prev up next →