vibe.d beta banner
get vibe.d

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.


this (pathstr) Constructs a Path object by parsing a path string.
this (nodes, absolute) Constructs a path object from a list of PathEntry objects.
this (entry) Constructs a relative path with one path entry.


absolute[get] boolDetermines if the path is absolute.
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


normalize () Resolves all '.' and '..' path entries as far as possible.
opBinary (rhs)
opBinary (rhs)
opBinary (rhs)
opCmp (rhs)
opDollar ()
opEquals (rhs) Tests two paths for equality using '=='.
opIndex (idx)
opOpAssign (rhs)
opOpAssign (rhs)
opOpAssign (rhs)
opOpAssign (rhs)
opSlice (start, end)
startsWith (rhs) Tests if rhs is an anchestor or the same as this path.
toHash ()
toNativeString () Converts the Path object to a native path string (backslash as path separator on Windows).
toString () Converts the Path back to a string representation using slashes.

Sönke Ludwig


© 2012-2015 RejectedSoftware e.K.


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