← back to roto on ba3a.dev

RelativePath

The one rule for paths a consuming project writes in roto.json: forward slashes, relative to the project root, and portable to every desktop file system. Each segment is non-empty, is not . or .., and avoids the characters Windows forbids in file names — so a path that validates on Linux also works on Windows, and no path can climb out of the project root.

Functions

Link copied to clipboard
fun resolve(root: Path, path: String, what: String): Path

path, validated, resolved against root.

Link copied to clipboard

name made valid as one path segment: every character the rule forbids becomes _.

Link copied to clipboard
fun validate(path: String, what: String)

Throws unless path is a valid relative path; what names it in the message.