# gizlang:path

```gizlang
import * as Path from "gizlang:path";
```

## Functions

### `isAbsolute`

```gizlang
function isAbsolute(path: string): bool
```

POSIX lexical paths. No filesystem access or capability is granted here.
normalize scans once, stores segment slices, and assembles one output buffer.

Effects: fail.

### `normalize`

```gizlang
function normalize(path: string): string
```

PATH without empty parts, `.` parts and `..` parts that a parent cancels.

Effects: fail.

### `join`

```gizlang
function join(parts: Vec<string>): string
```

Empty parts are ignored; a later leading slash does not reset the path.

Effects: fail.

### `basename`

```gizlang
function basename(path: string): string
```

The last part of PATH, without trailing separators.

Effects: fail.

### `dirname`

```gizlang
function dirname(path: string): string
```

PATH without its last part: `.` when there is no parent, `/` for a part at the root.

Effects: fail.

### `extension`

```gizlang
function extension(path: string): string
```

Last suffix including '.', except a leading dot and the special names ./..

Effects: fail.

### `relative`

```gizlang
function relative(from: string, to: string): string
```

The 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`

```gizlang
function portable(path: string): bool
```

Whether 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.

