vibe.d beta banner
get vibe.d
0.8.1

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

Struct Path

Represents an absolute or relative file system path.

struct Path ;

This struct allows to do safe operations on paths, such as concatenation and sub paths. Checks are done to disallow invalid operations such as concatenating two absolute paths. It also validates path strings and allows for easy checking of malicious relative paths.

Constructors

NameDescription
thisConstructs a relative path with one path entry.
thisConstructs a path object from a list of PathEntry objects.
thisConstructs a Path object by parsing a path string.

Properties

NameTypeDescription
absolute[get]boolDetermines if the path is absolute.
bySegment[get]immutable(PathEntry)[]Forward compatibility property for vibe-code
empty[get]boolTrue if the path contains no entries
endsWithSlash[get, set]boolDetermines if the path ends with a slash (i.e. is a directory)
external[get]boolDetermines if this path goes outside of its base path (i.e. begins with '..').
head[get]immutable(PathEntry)The last entry of the path
length[get]ulongThe number of path entries of which this path is composed
nodes[get]immutable(PathEntry)[]The ist of path entries of which this path is composed
parentPath[get]PathThe parent path

Methods

NameDescription
normalizeResolves all '.' and '..' path entries as far as possible.
opBinary
opBinary
opBinary
opCmp
opDollar
opEqualsTests two paths for equality using '=='.
opIndex
opOpAssign
opOpAssign
opOpAssign
opOpAssign
opSlice
startsWithTests if rhs is an anchestor or the same as this path.
toHash
toNativeStringConverts the Path object to a native path string (backslash as path separator on Windows).
toStringConverts the Path back to a string representation using slashes.

Aliases

NameDescription
SegmentForward compatibility alias for vibe-core
Authors

Sönke Ludwig

Copyright

© 2012-2015 RejectedSoftware e.K.

License

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