GenericPath

Provides a common interface to operate on paths of various kinds.

Constructors

this
this(string p)

Constructs a path from its string representation.

this
this(Segment segment)
this(Segment2 segment)

Constructs a path from a single path segment.

this
this(R segments)

Constructs a path from an input range of Segments.

Members

Aliases

Format
alias Format = F
Undocumented in source.

Functions

normalize
void normalize()

Removes any redundant path segments and replaces all separators by the default one.

opBinary
GenericPath opBinary(string subpath)
GenericPath opBinary(Segment subpath)
GenericPath opBinary(Segment2 subpath)
GenericPath opBinary(GenericPath!F.Segment subpath)
GenericPath opBinary(GenericPath!F.Segment2 subpath)
GenericPath opBinary(GenericPath subpath)
GenericPath opBinary(GenericPath!F subpath)
GenericPath opBinary(R entries)

Concatenates two paths.

opCast
P opCast()

Converts the path to a different path format.

opEquals
bool opEquals(GenericPath other)

Compares two path objects.

opOpAssign
void opOpAssign(T op)

Appends a relative path to this path.

startsWith
bool startsWith(GenericPath prefix)

Tests whether the given path is a prefix of this path.

toHash
size_t toHash()

Computes a hash sum, enabling storage within associative arrays.

toString
string toString()

Returns the string representation of the path.

Properties

absolute
bool absolute [@property getter]

Tests if the path is absolute.

byPrefix
auto byPrefix [@property getter]

Iterates over the path by segment, each time returning the sub path leading to that segment.

bySegment
PathRange bySegment [@property getter]

Iterates over the path by Segment.

bySegment2
auto bySegment2 [@property getter]

Iterates over the individual segments of the path.

empty
bool empty [@property getter]

Tests if the path is represented by an empty string.

endsWithSlash
bool endsWithSlash [@property getter]
bool endsWithSlash [@property setter]

Determines whether the path ends with a path separator (i.e. represents a folder specifically).

fileExtension
auto fileExtension [@property getter]

The extension part of the file name pointed to by the path.

hasParentPath
bool hasParentPath [@property getter]

Determines if the parentPath property is valid.

head
Segment head [@property getter]

Returns the trailing segment of the path.

head2
Segment2 head2 [@property getter]

Returns the trailing segment of the path.

normalized
GenericPath normalized [@property getter]

Returns the normalized form of the path.

parentPath
GenericPath parentPath [@property getter]

Returns a prefix of this path, where the last segment has been dropped.

Static functions

fromString
GenericPath fromString(string p)

Constructs a path from its string representation.

fromTrustedString
GenericPath fromTrustedString(string p)

Constructs a path from its string representation, skipping the validation.

isSeparator
bool isSeparator(dchar ch)

Tests if a certain character is a path segment separator.

Structs

PathRange
struct PathRange

Represents a path as an forward range of Segments.

Segment
struct Segment

A single path segment.

Segment2
struct Segment2

A single path segment.

Variables

defaultSeparator
enum char defaultSeparator;

The default path segment separator character.

Meta