vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Struct GenericPath

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

struct GenericPath(F) ;

Constructors

NameDescription
this (p) Constructs a path from its string representation.
this (segment) Constructs a path from a single path segment.
this (segments) Constructs a path from an input range of Segments.

Fields

NameTypeDescription
m_path string

Properties

NameTypeDescription
absolute[get] boolTests if the path is absolute.
byPrefix[get] autoIterates over the path by segment, each time returning the sub path leading to that segment.
bySegment[get] autoIterates over the individual segments of the path.
empty[get] boolTests if the path is represented by an empty string.
endsWithSlash[get, set] boolDetermines whether the path ends with a path separator (i.e. represents a folder specifically).
fileExtension[get] autoThe extension part of the file name pointed to by the path.
hasParentPath[get] boolDetermines if the parentPath property is valid.
head[get] GenericPath.SegmentReturns the trailing segment of the path.
normalized[get] GenericPathReturns the normalized form of the path.
parentPath[get] GenericPathReturns a prefix of this path, where the last segment has been dropped.

Methods

NameDescription
fromString (p) Constructs a path from its string representation.
fromTrustedString (p) Constructs a path from its string representation, skipping the validation.
isSeparator (ch) Tests if a certain character is a path segment separator.
normalize () Removes any redundant path segments and replaces all separators by the default one.
opBinary (subpath) Concatenates two paths.
opCast () Converts the path to a different path format.
opEquals (other) Compares two path objects.
opOpAssign (op) Appends a relative path to this path.
startsWith (prefix) Tests whether the given path is a prefix of this path.
toHash () Computes a hash sum, enabling storage within associative arrays.
toString () Returns the string representation of the path.

Inner structs

NameDescription
Segment A single path segment.

Aliases

NameDescription
bySegment2 vibe-core 1.x compatibility alias
Format
head2
Segment2 vibe-core 1.x compatibility alias
Authors

Sönke Ludwig

Copyright

© 2012-2021 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.