Struct Path
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.
Properties
Property name | Type | Description |
---|---|---|
absolute | bool | Determines if the path is absolute . |
head | PathEntry | The last entry of the path |
parentPath | Path | The parent path |
nodes | - | The ist of path entries of which this path is composed |
length | uint | The number of path entries of which this path is composed |
empty | bool | True if the path contains no entries |
endsWithSlash | bool | Determines if the path ends with a slash (i.e. is a directory) |
external | bool | Determines if this path goes outside of its base path (i.e. begins with '..'). |
Methods
Method name | Description |
---|---|
this | Constructs a Path object by parsing a path string. |
this | Constructs a path object from a list of PathEntry objects. |
this | Constructs a relative path with one path entry . |
normalize | Resolves all '.' and '..' path entries as far as possible. |
toString | Converts the Path back to a string representation using slashes. |
toNativeString | Converts the Path object to a native path string (backslash as path separator on Windows). |
startsWith | Tests if `rhs ` is an anchestor or the same as this path. |
relativeTo | Computes the relative path from `parentPath ` to this path. |
opIndex | |
opSlice | |
opDollar | |
opBinary | |
opBinary | |
opBinary | |
opOpAssign | |
opOpAssign | |
opOpAssign | |
opEquals | |
opCmp | |
__xopEquals |
Authors
Sönke Ludwig
Copyright
© 2012 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.