gizlang:path
import * as Path from "gizlang:path";Functions
isAbsolute
function isAbsolute(path: string): boolPOSIX lexical paths. No filesystem access or capability is granted here. normalize scans once, stores segment slices, and assembles one output buffer.
Effects: fail.
normalize
function normalize(path: string): stringPATH without empty parts, . parts and .. parts that a parent cancels.
Effects: fail.
join
function join(parts: Vec<string>): stringEmpty parts are ignored; a later leading slash does not reset the path.
Effects: fail.
basename
function basename(path: string): stringThe last part of PATH, without trailing separators.
Effects: fail.
dirname
function dirname(path: string): stringPATH without its last part: . when there is no parent, / for a part at the root.
Effects: fail.
extension
function extension(path: string): stringLast suffix including '.', except a leading dot and the special names ./..
Effects: fail.
relative
function relative(from: string, to: string): stringThe path from directory from to to, both normalized first, as Node's
path.relative: relative("web/comments", "web/model.giz") is
"../model.giz", and "." for the same place. Both must be absolute or both
relative to one directory; a relative from must not climb above it with
"..", since the names it would climb back down through are unknown.
Effects: fail.
portable
function portable(path: string): boolWhether PATH is a relative path that every target system can store as written and that names one file: segments
split by /, none empty, . or .., none ending in . or a space, no control byte and none of \ : * ? " < > |,
and no Windows device name (CON, PRN, AUX, NUL, COM1-COM9, LPT1-LPT9, CONIN$, CONOUT$, in any
case and with any extension). The one rule for package paths and release payload paths.
Effects: fail.