All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Classes | Functions
filesystem Namespace Reference

Classes

class  FileSystemError
 

Functions

bool existFile (const std::string &path)
 
bool existDirectory (const std::string &path)
 
bool existDirectory (const std::string &parentDirectory, const std::string &name)
 
void listDirectory (const std::string &path, std::vector< std::string > &entries)
 
void createDirectory (const std::string &path)
 
void createDirectory (const std::string &parentDirectory, const std::string &name)
 
void removeDirectory (const std::string &path)
 
void renameDirectory (const std::string &path, const std::string &newPath)
 
long long getFileSize (const std::string &path)
 
std::string getCurrentDirectory ()
 
bool isAbsolutePath (const std::string &path)
 

Detailed Description

A namespace with filesystem utility functions.

Function Documentation

void filesystem::createDirectory ( const std::string &  path)

Create a directory in the given absolute path.

Parameters
pathAn absolute directory path.
Exceptions
FileSystemErrorif the operation has failed.
void filesystem::createDirectory ( const std::string &  parentDirectory,
const std::string &  name 
)

Create a directory in the given parent directory.

Parameters
parentDirectoryThe absolue path of a parent directory.
nameA name for the new directory.
Exceptions
FileSystemErrorif the operation has failed.
bool filesystem::existDirectory ( const std::string &  path)
Parameters
pathThe path of a certain directory.
Returns
true if the directory exists, false if it doesn't or if there is an error.
bool filesystem::existDirectory ( const std::string &  parentDirectory,
const std::string &  name 
)
Parameters
parentDirectoryThe path of a certain directory.
nameThe name of a certain directory.
Returns
true if <name> exists as child of <parentDirectory>, false if it doesn't or if there is an error.
bool filesystem::existFile ( const std::string &  path)

Max size allowed for an absolute path.

Parameters
pathThe path of a certain file.
Returns
true if the file exists, false if it doesn't or if there is an error.
string filesystem::getCurrentDirectory ( )
Returns
String with the Current Working Director (CWD) of the calling process, as an absolute path.
Exceptions
FileSystemErrorif the operation has failed.
long long filesystem::getFileSize ( const std::string &  path)
Parameters
pathAn absolute file path.
Returns
The size of the given file (a 64 bit integer).
Exceptions
FileSystemErrorif the operation has failed.
bool filesystem::isAbsolutePath ( const std::string &  path)
Parameters
pathA path of a file or a directory.
Returns
true if the given path is an absolute path, false otherwise.
void filesystem::listDirectory ( const std::string &  path,
std::vector< std::string > &  entries 
)

List a given directory.

Parameters
pathThe path of a certain directory.
entriesA string vector to store the directory content.
Exceptions
FileSystemErrorif the operation has failed.
void filesystem::removeDirectory ( const std::string &  path)

Remove the given absolute directory path.

Parameters
pathAn absolute directory path.
Exceptions
FileSystemErrorif the operation has failed.
void filesystem::renameDirectory ( const std::string &  path,
const std::string &  newPath 
)

Rename the given absolute directory path.

Parameters
newPathThe new name for the directory.
Exceptions
FileSystemErrorif the operation has failed.