BASIS  r3148
basis::os Namespace Reference

Namespaces

namespace  path

Functions

bool emptydir (const std::string &path)
 Remove files and directories from directory.
std::string exedir ()
 Get canonical path of directory containing executable file.
std::string exename ()
 Get name of executable.
std::string exepath ()
 Get canonical path of executable file.
std::string getcwd ()
 Get absolute path of the (current) working directory.
bool makedirs (const std::string &path)
 Make directory including parent directories if required.
bool mkdir (const std::string &path)
 Make directory.
std::string readlink (const std::string &path)
 Read value of symbolic link.
bool rmdir (const std::string &path)
 Remove empty directory.
bool rmtree (const std::string &path)
 Remove whole directory tree.

Function Documentation

bool basis::os::emptydir ( const std::string &  path)

Remove files and directories from directory.

Parameters:
pathPath of the directory.
Returns:
Whether the directory was cleared successfully, i.e., leaving the directory path empty.

Definition at line 234 of file os.cxx.

string basis::os::exedir ( )

Get canonical path of directory containing executable file.

Returns:
Canonical path of directory containing executable file.
See also:
exepath()
exename()

Definition at line 136 of file os.cxx.

string basis::os::exename ( )

Get name of executable.

Note:
The name of the executable may or may not include the file name extension depending on the executable type and operating system. Hence, this function is neither an equivalent to path::basename(exepath()) nor path::filename(exepath()). In particular, on Windows, the .exe and .com extension is not included in the returned executable name.
Returns:
Name of the executable derived from the executable's file path or empty string on error.
See also:
exepath()
exedir()

Definition at line 123 of file os.cxx.

string basis::os::exepath ( )

Get canonical path of executable file.

Returns:
Canonical path of executable file or empty string on error.
See also:
exedir()
exename()

Definition at line 59 of file os.cxx.

string basis::os::getcwd ( )

Get absolute path of the (current) working directory.

Returns:
Absolute path of working directory or empty string on error.

Definition at line 43 of file os.cxx.

bool basis::os::makedirs ( const std::string &  path)

Make directory including parent directories if required.

Parameters:
pathPath of the directory.
Returns:
Whether the directory was created successfully. Note that on Posix, the created directories will have mode 0755. On Windows, the default security descriptor is passed on to the CreateDirectory() function.

Definition at line 201 of file os.cxx.

bool basis::os::mkdir ( const std::string &  path)

Make directory.

Note:
The parent directory must exist already. See makedirs() for a function that also creates the parent directories if none-existent.
Parameters:
pathPath of the directory.
Returns:
Whether the directory was created successfully. Note that on Posix, the created directory will have mode 0755. On Windows, the default security descriptor is passed on to the CreateDirectory() function.
See also:
makedirs()

Definition at line 195 of file os.cxx.

string basis::os::readlink ( const std::string &  path)

Read value of symbolic link.

Parameters:
[in]pathPath of symbolic link.
Returns:
Value of symbolic link. Can be relative or absolute path. If the link could not be read, an empty string is returned. Note that on Windows, this function always returns an empty string.
See also:
realpath()

Definition at line 143 of file os.cxx.

bool basis::os::rmdir ( const std::string &  path)

Remove empty directory.

This function removes an empty directory. If the directory is not empty, it will fail. See rmtree() for a function that also removes the files and recursively the directories within the specified directory.

Parameters:
pathPath of the directory.
Returns:
Whether the directory was removed successfully.
See also:
rmtree()

Definition at line 222 of file os.cxx.

bool basis::os::rmtree ( const std::string &  path)

Remove whole directory tree.

Parameters:
pathPath of the directory.
Returns:
Whether the directory was removed successfully.

Definition at line 228 of file os.cxx.