group Path utils

Path utils

Functions

Name
vector< string >pathsplit(const string & path)
Split a path string with colon delimiters.
stringpathjoin(const vector< string > & paths)
Join several filesystem paths together with the standard ‘:’ delimiter.
stringoperator/(const string & a, const string & b)
Operator for joining strings a and b with filesystem separators.
stringbasename(const string & p)
Get the basename (i.e. terminal file name) from a path p.
stringdirname(const string & p)
Get the dirname (i.e. path to the penultimate directory) from a path p.
stringfile_stem(const string & f)
Get the stem (i.e. part without a file extension) from a filename f.
stringfile_extn(const string & f)
Get the file extension from a filename f.

Functions Documentation

function pathsplit

inline vector< string > pathsplit(
    const string & path
)

Split a path string with colon delimiters.

Ignores zero-length substrings. Designed for getting elements of filesystem paths, naturally.

function pathjoin

inline string pathjoin(
    const vector< string > & paths
)

Join several filesystem paths together with the standard ‘:’ delimiter.

Note that this does NOT join path elements together with a platform-portable directory delimiter, cf. the Python {os.path.join}!

function operator/

inline string operator/(
    const string & a,
    const string & b
)

Operator for joining strings a and b with filesystem separators.

function basename

inline string basename(
    const string & p
)

Get the basename (i.e. terminal file name) from a path p.

function dirname

inline string dirname(
    const string & p
)

Get the dirname (i.e. path to the penultimate directory) from a path p.

function file_stem

inline string file_stem(
    const string & f
)

Get the stem (i.e. part without a file extension) from a filename f.

function file_extn

inline string file_extn(
    const string & f
)

Get the file extension from a filename f.


Updated on 2022-08-07 at 20:17:17 +0100