Open Lighting Architecture
Latest Git
|
File helper functions.
Functions | |
string | ConvertPathSeparators (const std::string &path) |
Convert all separators in a path to the OS's version. More... | |
string | JoinPaths (const std::string &first, const std::string &second) |
Join two parts of a path. More... | |
bool | FindMatchingFiles (const std::string &directory, const std::string &prefix, std::vector< std::string > *files) |
Find all files in a directory that match the given prefix. More... | |
bool | FindMatchingFiles (const std::string &directory, const std::vector< std::string > &prefixes, std::vector< std::string > *files) |
Find all files in a directory that match any of the prefixes. More... | |
bool | ListDirectory (const std::string &directory, std::vector< std::string > *files) |
Get a list of all files in a directory. More... | |
string | FilenameFromPathOrDefault (const std::string &path, const std::string &default_value) |
Convert a path to a filename. More... | |
string | FilenameFromPathOrPath (const std::string &path) |
Convert a path to a filename (this variant is good for switching based on executable names) More... | |
string | FilenameFromPath (const std::string &path) |
Convert a path to a filename. More... | |
Variables | |
const char | PATH_SEPARATOR = '/' |
std::string ola::file::ConvertPathSeparators | ( | const std::string & | path | ) |
Convert all separators in a path to the OS's version.
path | the path to convert |
std::string ola::file::FilenameFromPath | ( | const std::string & | path | ) |
Convert a path to a filename.
path | a full path to a file |
std::string ola::file::FilenameFromPathOrDefault | ( | const std::string & | path, |
const std::string & | default_value | ||
) |
Convert a path to a filename.
path | a full path to a file |
default_value | what to return if the path can't be found |
std::string ola::file::FilenameFromPathOrPath | ( | const std::string & | path | ) |
Convert a path to a filename (this variant is good for switching based on executable names)
path | a full path to a file |
bool ola::file::FindMatchingFiles | ( | const std::string & | directory, |
const std::string & | prefix, | ||
std::vector< std::string > * | files | ||
) |
Find all files in a directory that match the given prefix.
[in] | directory | the directory to look in |
[in] | prefix | the prefix to match on |
[out] | files | a pointer to a vector with the absolute path of the matching files. |
bool ola::file::FindMatchingFiles | ( | const std::string & | directory, |
const std::vector< std::string > & | prefixes, | ||
std::vector< std::string > * | files | ||
) |
Find all files in a directory that match any of the prefixes.
[in] | directory | the directory to look in |
[in] | prefixes | the prefixes to match on |
[out] | files | a pointer to a vector with the absolute path of the matching files. |
std::string ola::file::JoinPaths | ( | const std::string & | first, |
const std::string & | second | ||
) |
Join two parts of a path.
first | The first part of the path. |
second | The second part of the path. |
bool ola::file::ListDirectory | ( | const std::string & | directory, |
std::vector< std::string > * | files | ||
) |
Get a list of all files in a directory.
Entries in
files | will contain the full path to the file. | |
[in] | directory | the directory to list |
[out] | files | a pointer to a string vector that will receive file paths |