vibe.d beta banner
get vibe.d
0.7.30

Struct Path

Represents an absolute or relative file system 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

Name Description
this Constructs a relative path with one path entry.
this Constructs a path object from a list of PathEntry objects.
this Constructs a Path object by parsing a path string.

Properties

Name Type Description
absolute [get] bool Determines if the path is absolute.
empty [get] bool True if the path contains no entries
endsWithSlash [get, set] bool Determines if the path ends with a slash (i.e. is a directory)
external [get] bool Determines 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] ulong The 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] Path The parent path

Methods

Name Description
normalize Resolves all '.' and '..' path entries as far as possible.
opBinary
opBinary
opBinary
opCmp
opDollar
opEquals Tests two paths for equality using '=='.
opIndex
opOpAssign
opOpAssign
opOpAssign
opOpAssign
opSlice
startsWith 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.
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.