Skip to content

AbsolutePath

[<Struct>]
type AbsolutePath =
    | AbsolutePath of value: string
AssemblyNacara.Core
Attributes[<Struct>]

An absolute path on disk, normalized to use / as its separator.

Normalizing at the boundary means paths compare and hash consistently on every platform

Cases

AbsolutePath of value: string

Functions and values

combine (root: AbsolutePath) (segments: string list) : AbsolutePath

Create an absolute path by combining root with segments.

Parameter
rootWhere to start from.
segmentsWhat to append. A segment that is itself rooted wins outright, which is how an option holding an absolute path overrides a project-relative one.
create (value: string) : AbsolutePath

Create an absolute path, failing when value is not rooted.

Parameter
valueA rooted path. It is normalised - resolved, and written with forward slashes on every platform - so two spellings of one path compare equal.
Raises
System.ArgumentExceptionThe path is empty, or is relative.
directory (AbsolutePath) : AbsolutePath

The directory holding it.

exists (AbsolutePath) : bool

Whether anything is there: a file or a directory.

extension (AbsolutePath) : string

The extension, dot included, or an empty string when there is none.

fileName (AbsolutePath) : string

The last segment, extension included.

toLog (AbsolutePath) : string

Quoted form used in log and diagnostic messages.

value (AbsolutePath) : string

The path as text, normalised, for the APIs that take a string.