Stride Reference Manual
- generated for commit 9643b11
|
Utilities for interaction with filesystem. More...
#include <FileSys.h>
Classes | |
struct | Dirs |
Using this to avoid global variables & their initialization. More... | |
Static Public Member Functions | |
static bool | IsDirectoryString (const std::string &s) |
String represents a directory path (relative or absolute) iff it contains at least one / (may be a trailing one). More... | |
static bool | CreateDirectory (std::string s) |
Create a directory relative to the current directory with the given path, returns if it was succesful. More... | |
static filesys::path | BuildPath (const std::string &output_prefix, const std::string &filename) |
Interpret prefix (directory or filename prefix) and return appropriate path. More... | |
static boost::property_tree::ptree | ReadPtreeFile (const filesys::path &f_p) |
Read ptree from file at path. More... | |
static boost::property_tree::ptree | ReadPtreeFile (const std::string &f_n) |
Read ptree from file specifified by name string. More... | |
static void | WritePtreeFile (const filesys::path &f_p, const boost::property_tree::ptree &pt) |
Write ptree to file at path. More... | |
static void | WritePtreeFile (const std::string &f_n, const boost::property_tree::ptree &pt) |
Write ptree to file specifified by name string. More... | |
static filesys::path | GetCurrentDir () |
Get path to the current directory. More... | |
static filesys::path | GetExecPath () |
Get path of the executable. More... | |
static bool | CheckInstallEnv (std::function< void(const std::string &)> logger=std::function< void(const std::string &)>()) |
Verify that current dir is root dir and all install dirs are present. More... | |
static filesys::path | GetBinDir () |
Return bin dir (only relevant when use_install_dirs mode is active) More... | |
static filesys::path | GetConfigDir () |
Return config dir (only relevant when use_install_dirs mode is active) More... | |
static filesys::path | GetDataDir () |
/// Return data dir (only relevant when use_install_dirs mode is active) More... | |
static filesys::path | GetRootDir () |
Return install root dir (only relevant when use_install_dirs mode is active) More... | |
static filesys::path | GetTestsDir () |
Return tests dir (only relevant when use_install_dirs mode is active) More... | |
Static Private Member Functions | |
static Dirs | Initialize () |
Initialize all paths. More... | |
static Dirs & | Get () |
Return paths. More... | |
|
static |
String represents a directory path (relative or absolute) iff it contains at least one / (may be a trailing one).
Definition at line 193 of file FileSys.cpp.
Referenced by BuildPath(), and stride::ControlHelper::CheckOutputPrefix().
|
static |
Create a directory relative to the current directory with the given path, returns if it was succesful.
Definition at line 199 of file FileSys.cpp.
Referenced by stride::ControlHelper::CheckOutputPrefix().
|
static |
Interpret prefix (directory or filename prefix) and return appropriate path.
Definition at line 52 of file FileSys.cpp.
References IsDirectoryString().
Referenced by stride::GenPopController::Control(), stride::StanController::Control(), stride::Population::Create(), stride::output::InfectedFile::InfectedFile(), stride::output::SummaryFile::Initialize(), stride::output::PersonsFile::Initialize(), and stride::ControlHelper::InstallLogger().
|
static |
Read ptree from file at path.
Definition at line 208 of file FileSys.cpp.
Referenced by stride::SimBuilder::ReadAgeContactPtree(), stride::SimBuilder::ReadDiseasePtree(), and stride::DiseaseSeeder::Vaccinate().
|
static |
Read ptree from file specifified by name string.
Definition at line 227 of file FileSys.cpp.
|
static |
Write ptree to file at path.
Definition at line 229 of file FileSys.cpp.
|
static |
Write ptree to file specifified by name string.
Definition at line 240 of file FileSys.cpp.
|
inlinestatic |
Get path to the current directory.
Definition at line 69 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_current_dir.
Referenced by stride::ControlHelper::LogStartup().
|
inlinestatic |
Get path of the executable.
Definition at line 72 of file FileSys.h.
References CheckInstallEnv(), Get(), and stride::util::FileSys::Dirs::m_exec_path.
Referenced by stride::ControlHelper::LogStartup().
|
static |
Verify that current dir is root dir and all install dirs are present.
logger | logger verification finds failures; defaults to no-op. |
There has to be a config dir in the install root dir.
There has to be a data dir in the install root dir.
There has to be a data dir in the install root dir.
Definition at line 65 of file FileSys.cpp.
Referenced by stride::ControlHelper::CheckEnv(), and GetExecPath().
|
inlinestatic |
Return bin dir (only relevant when use_install_dirs mode is active)
Definition at line 82 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_bin_dir.
|
inlinestatic |
Return config dir (only relevant when use_install_dirs mode is active)
Definition at line 85 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_config_dir.
Referenced by stride::ControlHelper::LogStartup().
|
inlinestatic |
/// Return data dir (only relevant when use_install_dirs mode is active)
Definition at line 88 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_data_dir.
Referenced by geopop::ReaderFactory::CreateCommutesReader(), geopop::ReaderFactory::CreateHouseholdReader(), geopop::ReaderFactory::CreateLocationsReader(), stride::Calendar::InitializeHolidays(), stride::ControlHelper::LogStartup(), stride::DefaultPopBuilder::MakePersons(), stride::SimBuilder::ReadAgeContactPtree(), and stride::SimBuilder::ReadDiseasePtree().
|
inlinestatic |
Return install root dir (only relevant when use_install_dirs mode is active)
Definition at line 91 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_root_dir.
Referenced by stride::ControlHelper::LogStartup().
|
inlinestatic |
Return tests dir (only relevant when use_install_dirs mode is active)
Definition at line 94 of file FileSys.h.
References Get(), and stride::util::FileSys::Dirs::m_tests_dir.
|
staticprivate |
Initialize all paths.
Definition at line 102 of file FileSys.cpp.
References stride::util::FileSys::Dirs::m_bin_dir, stride::util::FileSys::Dirs::m_config_dir, stride::util::FileSys::Dirs::m_current_dir, stride::util::FileSys::Dirs::m_data_dir, stride::util::FileSys::Dirs::m_exec_path, stride::util::FileSys::Dirs::m_root_dir, stride::util::FileSys::Dirs::m_tests_dir, and stride::util::ToLower().
|
staticprivate |
Return paths.
Definition at line 96 of file FileSys.cpp.
Referenced by GetBinDir(), GetConfigDir(), GetCurrentDir(), GetDataDir(), GetExecPath(), GetRootDir(), and GetTestsDir().