Utopia
2
Framework for studying models of complex & adaptive systems.
|
Functions | |
std::string | Utopia::DataIO::expanduser (const std::string &path) |
Expands a path with a leading ~ character into an absolute path. More... | |
std::string | Utopia::DataIO::get_abs_filepath (const Config &cfg) |
Extracts an absolute file path from a configuration. More... | |
std::string Utopia::DataIO::expanduser | ( | const std::string & | path | ) |
Expands a path with a leading ~
character into an absolute path.
This function uses the environment variable HOME
and replaces a leading ~
character with that path. If there was no leading ~
character, the given path is returned.
path | The path to expand |
If | the given path needs expansion but no HOME environment variable was set. |
std::string Utopia::DataIO::get_abs_filepath | ( | const Config & | cfg | ) |
Extracts an absolute file path from a configuration.
Expected keys: filename
, base_dir
(optional). If no base_dir
key is present, will prepend the current working directory.
If the base directory or the filename specify a relative directory, the resulting absolute path will start from the current working directory.
Furthermore, this function will call expanduser to allow using the ~
character to refer to the home directory.
cfg | The configuration node with required key filename and optional key base_dir . |