b2api
B2000++ API Reference Manual, VERSION 4.6
 
Loading...
Searching...
No Matches
b2000::path Namespace Reference

Functions

bool isabs (const std::string &path)
 
bool isfile (const std::string &path)
 
bool isdir (const std::string &path)
 
bool islink (const std::string &path)
 
bool isexec (const std::string &path)
 
std::string getcwd ()
 
std::string dirname (const std::string &path)
 
std::string basename (const std::string &path)
 
std::pair< std::string, std::string > splitext (const std::string &path)
 
std::string abspath (const std::string &path)
 
std::string realpath (const std::string &path)
 
std::string which (const std::string &cmd)
 
std::string join (const std::string &a, const std::string &b)
 
void rmtree (const std::string &path, bool ignore_errors=false)
 

Detailed Description

Contains platform-independent C++ functions for pathname manipulation.

Function Documentation

◆ abspath()

std::string b2000::path::abspath ( const std::string &  path)

Return a normalized absolutized version of the pathname path.

This adds the current directory if necessary and collapses redundant separators and up-level references, e.g. A//B, A/./B and A/foo/../B all become A/B.

◆ basename()

std::string b2000::path::basename ( const std::string &  path)
Returns
the base name of the path.

◆ dirname()

std::string b2000::path::dirname ( const std::string &  path)
Returns
the directory name of the path.

◆ getcwd()

std::string b2000::path::getcwd ( )
Returns
the name of the current directory.

◆ isabs()

bool b2000::path::isabs ( const std::string &  path)
Returns
Whether path is an absolute pathname (begins with a slash).

◆ isdir()

bool b2000::path::isdir ( const std::string &  path)
Returns
Whether path is an existing directory.

This follows symbolic links, so both islink() and isdir() can be true for the same path.

◆ isexec()

bool b2000::path::isexec ( const std::string &  path)
Returns
Whether path is an executable file.

This follows symbolic links, so both islink() and isexec() can be true for the same path.

◆ isfile()

bool b2000::path::isfile ( const std::string &  path)
Returns
Whether path is an existing regular file.

This follows symbolic links, so both islink() and isfile() can be true for the same path.

◆ islink()

bool b2000::path::islink ( const std::string &  path)
Returns
Whether path refers to a directory entry that is a symbolic link. Always false if symbolic links are not supported.

◆ join()

std::string b2000::path::join ( const std::string &  a,
const std::string &  b 
)

Join two fragments to a path.

◆ realpath()

std::string b2000::path::realpath ( const std::string &  path)

Expand all symbolic links and return the result.

◆ rmtree()

void b2000::path::rmtree ( const std::string &  path,
bool  ignore_errors = false 
)

Remove a complete directory tree.

◆ splitext()

std::pair< std::string, std::string > b2000::path::splitext ( const std::string &  path)
Returns
a pair (first, second) with first the path without the extension, and second containing the extension. If the path has no extension, second will be empty.

◆ which()

std::string b2000::path::which ( const std::string &  cmd)

Return the full path to the first match of the given command according to the PATH environment variable.