uniform-path

    Cross-platform paths with consistent / separators.

    path
    posix
    windows
    unc
    normalization
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    15 hours ago
    Downloads
    6

    Dependencies

    #uniform-path

    Cross-platform paths with consistent / separators.

    ResolveError

    pub(all) suberror ResolveError {
    DriveBaseRequired(drive~ : String, base~ : Path)
    }

    A drive-relative path cannot be resolved without a base on the same drive.

    ResolveError::output

    fn ResolveError::output(self : ResolveError, logger : &Logger) -> Unit

    ResolveError::to_string

    fn ResolveError::to_string(self : ResolveError) -> String

    Path

    pub struct Path {
    // private fields
    } derive(Eq)

    Platform-independent lexical path with / separators. Roots are stored separately so POSIX normalization cannot collapse UNC's leading // or mistake C:/ for a relative path. Absolute paths clamp .. at the root; relative paths retain leading ... An empty relative portion denotes the root, or . without a root. POSIX filenames retain backslashes. This type does not access the filesystem or resolve symlinks.
    impl Div for Path
    impl Show for Path

    Path::Path

    fn Path::Path(input : String) -> Path

    Parse POSIX paths or Windows drive/UNC paths. Windows input is normalized at this boundary; all subsequent operations and output use / separators. Exactly two leading forward slashes select Windows UNC parsing; three or more select POSIX parsing. Absolute POSIX paths preserve backslashes occurring in file names.

    Path::basename

    fn Path::basename(self : Path) -> String

    Path::dirname

    fn Path::dirname(self : Path) -> Path

    Return the parent, stopping at POSIX, drive, and UNC share roots.

    Path::div

    fn Path::div(self : Path, other : Path) -> Path

    Path::equal

    fn Path::equal(Path, Path) -> Bool

    Path::join

    fn Path::join(self : Path, other : Path) -> Path

    Append the relative portion of another normalized path, preserving this path's root. The other path's root is ignored. Input syntax and separators are handled by Path::Path before joining.

    Path::not_equal

    fn Path::not_equal(x : Path, y : Path) -> Bool

    Path::output

    fn Path::output(self : Path, logger : &Logger) -> Unit

    Path::resolve

    fn Path::resolve(self : Path, other : Path) -> Path raise ResolveError

    Resolve another normalized path against this explicit base without reading the host environment. Absolute POSIX, drive, and UNC paths replace the base; ordinary relative paths are joined to it. The result can remain relative. A drive-relative path is joined to a base on the same drive, comparing drive letters without case sensitivity and preserving the base's root. Raises ResolveError::DriveBaseRequired when that drive base is unavailable.

    Path::to_string

    fn Path::to_string(self : Path) -> String

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io