MVE - Multi-View Environment mve-devel
|
Cross-platform file system functions. More...
Classes | |
class | Directory |
Directory abstraction to scan directory contents. More... | |
struct | File |
class | FileLock |
A simple file-based file lock implementation. More... | |
Functions | |
std::string | abspath (std::string const &path) |
Returns the absolute representation of the given path. | |
std::string | basename (std::string const &path) |
Returns the file name component of the given path. | |
void | copy_file (char const *src, char const *dst) |
Copies a file from 'src' to 'dst', throws FileException on error. | |
bool | dir_exists (char const *pathname) |
Determines if the given path is a directory. | |
std::string | dirname (std::string const &path) |
Returns the directory name component of the given path. | |
bool | exists (char const *pathname) |
Determines if the given path is a directory. | |
bool | file_exists (char const *pathname) |
Determines if the given path is a file. | |
char const * | get_app_data_dir (void) |
Determines the current user's path for application data. | |
std::string | get_binary_path (void) |
Returns the path of the binary currently executing. | |
char * | get_cwd (char *buf, size_t size) |
char * | get_cwd (char *buf, std::size_t size) |
Determines the current working directory of the process. | |
std::string | get_cwd_string (void) |
Determines the CWD and returns a convenient string. | |
char const * | get_home_dir (void) |
Determines the home path for the current user. | |
bool | is_absolute (std::string const &path) |
Checks whether the given path is absolute. | |
std::string | join_path (std::string const &path1, std::string const &path2) |
Concatenate and canonicalize two paths. | |
bool | mkdir (char const *pathname) |
Creates a new directory. | |
void | read_file_to_string (std::string const &filename, std::string *data) |
Reads the whole file into a string. | |
bool | rename (char const *from, char const *to) |
Renames the given file 'from' to new name 'to'. | |
std::string | replace_extension (std::string const &fn, std::string const &ext) |
Replaces extension of the given file with 'ext'. | |
bool | rmdir (char const *pathname) |
Removes an empty directory. | |
std::string | sanitize_path (std::string const &path) |
Canonicalize slashes in the given path. | |
bool | set_cwd (char const *pathname) |
Changes the current working directory to 'pathname' and returns true on success. | |
bool | unlink (char const *pathname) |
Unlinks (deletes) the given file. | |
void | write_string_to_file (char const *data, std::size_t len, std::string const &filename) |
Writes the given data into a file. | |
void | write_string_to_file (std::string const &data, std::string const &filename) |
Writes the given data into a file. | |
Variables | |
char | app_data_path [2048] = { 0 } |
char | home_path [2048] = { 0 } |
Cross-platform file system functions.
std::string util::fs::abspath | ( | std::string const & | path | ) |
Returns the absolute representation of the given path.
Definition at line 408 of file file_system.cc.
std::string util::fs::basename | ( | std::string const & | path | ) |
Returns the file name component of the given path.
Definition at line 440 of file file_system.cc.
void util::fs::copy_file | ( | char const * | src, |
char const * | dst | ||
) |
Copies a file from 'src' to 'dst', throws FileException on error.
Definition at line 248 of file file_system.cc.
bool util::fs::dir_exists | ( | char const * | pathname | ) |
Determines if the given path is a directory.
Definition at line 71 of file file_system.cc.
std::string util::fs::dirname | ( | std::string const & | path | ) |
Returns the directory name component of the given path.
Definition at line 414 of file file_system.cc.
bool util::fs::exists | ( | char const * | pathname | ) |
Determines if the given path is a directory.
Definition at line 53 of file file_system.cc.
bool util::fs::file_exists | ( | char const * | pathname | ) |
Determines if the given path is a file.
Definition at line 95 of file file_system.cc.
char const * util::fs::get_app_data_dir | ( | void | ) |
Determines the current user's path for application data.
Definition at line 182 of file file_system.cc.
std::string util::fs::get_binary_path | ( | void | ) |
Returns the path of the binary currently executing.
Definition at line 303 of file file_system.cc.
char * util::fs::get_cwd | ( | char * | buf, |
size_t | size | ||
) |
Definition at line 119 of file file_system.cc.
char * util::fs::get_cwd | ( | char * | buf, |
std::size_t | size | ||
) |
Determines the current working directory of the process.
std::string util::fs::get_cwd_string | ( | void | ) |
Determines the CWD and returns a convenient string.
Definition at line 280 of file file_system.cc.
char const * util::fs::get_home_dir | ( | void | ) |
Determines the home path for the current user.
Definition at line 209 of file file_system.cc.
bool util::fs::is_absolute | ( | std::string const & | path | ) |
Checks whether the given path is absolute.
Definition at line 356 of file file_system.cc.
std::string util::fs::join_path | ( | std::string const & | path1, |
std::string const & | path2 | ||
) |
Concatenate and canonicalize two paths.
The result is where you would end up after cd path1; cd path2.
Definition at line 393 of file file_system.cc.
bool util::fs::mkdir | ( | char const * | pathname | ) |
Creates a new directory.
Definition at line 143 of file file_system.cc.
void util::fs::read_file_to_string | ( | std::string const & | filename, |
std::string * | data | ||
) |
bool util::fs::rename | ( | char const * | from, |
char const * | to | ||
) |
Renames the given file 'from' to new name 'to'.
Definition at line 237 of file file_system.cc.
std::string util::fs::replace_extension | ( | std::string const & | fn, |
std::string const & | ext | ||
) |
Replaces extension of the given file with 'ext'.
If the file name does not have an extension, the given extension is appended.
Definition at line 460 of file file_system.cc.
bool util::fs::rmdir | ( | char const * | pathname | ) |
Removes an empty directory.
Definition at line 159 of file file_system.cc.
std::string util::fs::sanitize_path | ( | std::string const & | path | ) |
Canonicalize slashes in the given path.
Definition at line 366 of file file_system.cc.
bool util::fs::set_cwd | ( | char const * | pathname | ) |
Changes the current working directory to 'pathname' and returns true on success.
NOTE: An application should never change its working directory. Make sure this is really necessary.
Definition at line 131 of file file_system.cc.
bool util::fs::unlink | ( | char const * | pathname | ) |
Unlinks (deletes) the given file.
Definition at line 170 of file file_system.cc.
void util::fs::write_string_to_file | ( | char const * | data, |
std::size_t | len, | ||
std::string const & | filename | ||
) |
void util::fs::write_string_to_file | ( | std::string const & | data, |
std::string const & | filename | ||
) |
char util::fs::app_data_path[2048] = { 0 } |
Definition at line 50 of file file_system.cc.
char util::fs::home_path[2048] = { 0 } |
Definition at line 49 of file file_system.cc.