Path

:= []

Filesystem paths backed by the shared roc-lang/path package.

from_os_str : OsStr -> Path

Create a path from an OS string without losing native path units.

to_os_str : Path -> OsStr

Convert a path to an OS string without losing native path units.

utf8 : Str -> Path

Create a portable UTF-8 text path.

from_quote : Str -> Try(Path, [BadQuotedBytes(Str)])

Create a portable UTF-8 path from a quoted literal.

unix : Str -> Path

Create a Unix path from a Roc string by storing its UTF-8 bytes.

unix_bytes : List(U8) -> Path

Create a Unix path from raw bytes without validating UTF-8.

windows : Str -> Path

Create a Windows path from a Roc string by storing its UTF-16 code units.

to_str : Path -> Try(Str, [InvalidStr(U64)])

Convert a path to a string if its raw representation is valid text.

display : Path -> Str

Convert a path to a display string, replacing invalid text with U+FFFD.

filename : Path -> Try(Path, [IsDirPath, EndsInDots])

Returns everything after the last directory separator.

ext : Path -> Try(Path, [IsDirPath, EndsInDots])

Returns the filename extension without the leading dot.

join : Path, Str -> Path

Adds a separator and a string component to the path.

to_raw : Path -> Raw

Expose the raw OS-specific representation.

from_raw : Raw -> Path

Build a path from the raw OS-specific representation.

Path : Path

Filesystem path type from roc-lang/path.

Raw : [Utf8(Str), UnixBytes(List(U8)), WindowsU16s(List(U16))]

Raw OS-specific path representation used at platform boundaries.