Represents a POSIX or Windows file system path and offers common path manipulations.
More...
Represents a POSIX or Windows file system path and offers common path manipulations.
When reading the comments below, keep in mind that '/' refers to the path separator character, so read it as "'/' or '\', depending on
platform".
std::string Path::dirname |
( |
| ) |
const |
|
inline |
Extracts the component up to, but not including, the final '/'.
Trailing '/' characters are not counted as part of the pathname.
Like the standard '::dirname()' except it is thread safe.
The following list of examples (taken from SUSv2) shows the strings returned by dirname() for different paths:
path | dirname |
"/usr/lib" | "/usr" |
"/usr/" | "/" |
"usr" | "." |
"/" | "/" |
"." | "." |
".." | "." |
- Returns
- The component up to, but not including, the final '/'. If Path does not contain a '/', then this returns the string ".". If Path is the string "/", then this returns the string "/". If Path is an empty string, then this returns the string ".".