Lyric v4.5.0

std.io.path

Joining, splitting and inspecting path STRINGS — no capability, because none of it touches the disk. Both separators count everywhere: Windows understands /, and a script running on both systems should not have to guess.

joinPath function

pub fn joinPath(left: string, right: string): string

Joins two path parts, with neither a doubled nor a missing separator.

stdlib/std/io/path.lyr:28

fileName function

pub fn fileName(path: string): string

The last component. "a/b/c.txt" becomes "c.txt".

stdlib/std/io/path.lyr:61

parentDir function

pub fn parentDir(path: string): string

Everything before the last separator, or "" when there is none.

stdlib/std/io/path.lyr:67

extension function

pub fn extension(path: string): string

The extension WITHOUT the dot. "" when there is none.

A leading dot does not count: ".gitignore" has no extension, that is its name. This rule differs between languages, so it is stated here.

stdlib/std/io/path.lyr:83

stem function

pub fn stem(path: string): string

The name without its extension. "a/b/c.txt" becomes "c".

stdlib/std/io/path.lyr:99

withExtension function

pub fn withExtension(path: string, ext: string): string

Replaces the extension. An empty extension removes it.

stdlib/std/io/path.lyr:109

isAbsolute function

pub fn isAbsolute(path: string): bool

Does the path start at the root? Recognises /x and C:\x.

stdlib/std/io/path.lyr:117