Quark
0.1
|
A collection of utility functions for manipulating file paths. More...
#include <PathUtils.h++>
Static Public Member Functions | |
static QString | filenameForPath (const QString &path) |
Returns the filename portion of a path. More... | |
static QString | basenameForPath (const QString &path) |
Returns the basename portion of a path. More... | |
static QString | extensionForPath (const QString &path) |
Returns the file extension portion of a path. More... | |
static QString | directoryForPath (const QString &path) |
Returns the direction portion of the path. More... | |
static QString | joinPath (const QString &dir, const QString &filename) |
Combines a directory with a filename, inserting a file separator if the directory does not end with one. More... | |
static QString | relativePath (const QString &path, const QString &prefix) |
Returns the portion of a path that is relative to the given prefix path, or an empty string if the path does not begin with that prefix path. More... | |
static QString | parentDirectoryForPath (const QString &path) |
Returns the parent directory of a given path. More... | |
static void | removeLastPathComponent (QString &path) |
Removes the last path component from the given path, that is, everything after and including the last file separator in the path. More... | |
A collection of utility functions for manipulating file paths.
|
static |
Returns the basename portion of a path.
The basename is the filename excluding any characters after the first '.' character. For example, the basename for '/var/log/logs.tar.gz' is 'logs'.
|
static |
Returns the direction portion of the path.
The directory is everything up to but not including the last file separator in the path, or an empty string if the path contains no file separators at all.
|
static |
Returns the file extension portion of a path.
The file extension is the portion of the filename following the first '.' character. For example, the extension for '/var/log/logs.tar.gz' is 'tar.gz'.
|
static |
Returns the filename portion of a path.
The filename is everything after the last file separator in the path, and as such, may be an empty string.
|
static |
Combines a directory with a filename, inserting a file separator if the directory does not end with one.
|
static |
Returns the parent directory of a given path.
For example, the parent directory of '/var/log/logs.tar.gz' is '/var/log', and the parent directory of '/var/log' (or '/var/log/') is '/var'. If the path consists of only a file separator, the same path is returned.
|
static |
Returns the portion of a path that is relative to the given prefix path, or an empty string if the path does not begin with that prefix path.
|
static |
Removes the last path component from the given path, that is, everything after and including the last file separator in the path.
If the path consists of a single path component starting with a file separator, returns a path consisting of just the file separator.