karazeh
A cross-platform software updating library.
|
#include <path_resolver.hpp>
Public Member Functions | |
path_resolver () | |
virtual | ~path_resolver () |
path_t const & | get_cache_path () const |
path_t const & | get_root_path () const |
void | resolve (path_t root="", bool verbose=false) |
Additional Inherited Members | |
Protected Member Functions inherited from kzh::logger | |
void | rename_context (string_t const &) |
logger (string_t context) | |
virtual | ~logger () |
logstream | alert () const |
logstream | crit () const |
logstream | debug () const |
logstream | error () const |
logstream | info () const |
logstream | notice () const |
logstream | plain () const |
void | set_uuid_prefix (string_t const &) |
string_t const & | uuid_prefix () const |
logstream | warn () const |
Static Protected Member Functions inherited from kzh::logger | |
static void | deindent () |
static void | enable_timestamps (bool on_or_off) |
static void | indent () |
static void | mute () |
static void | set_app_name (string_t const &app_name) |
static void | set_stream (std::ostream *) |
static void | set_threshold (char level) |
static void | unmute () |
kzh::path_resolver::path_resolver | ( | ) |
|
virtual |
path_t const & kzh::path_resolver::get_cache_path | ( | ) | const |
The "staging" directory used internally by Karazeh which resides in $ROOT/.kzh
.
Referenced by TEST_CASE().
path_t const & kzh::path_resolver::get_root_path | ( | ) | const |
The root path can be overridden at runtime via the -r option, otherwise it is assumed to be KZH_DISTANCE_FROM_ROOT steps above the directory that contains the running process.
For example, if the running process is at bin/something and KZH_DISTANCE_FROM_ROOT is set to 1, then the root will be correctly set to bin/..
All changes are deployted relative to the root path.
Referenced by TEST_CASE().
void kzh::path_resolver::resolve | ( | path_t | root = "" , |
bool | verbose = false |
||
) |
The directory of the running process.
On Linux, it is located using binreloc (see deps/binreloc/binreloc.h) On OS X, it is located using NSBundlePath() (see karazeh/utility.hpp) On Windows, it is located using GetModuleFileName() (see resolve_paths())
All the other paths are derived from the bin_path unless overridden.
std::runtime_error | LINUX ONLY: if binreloc could not be initialized for some reason. |
References kzh::logger::debug(), kzh::locate_bin_directory(), and kzh::locate_root_directory().
Referenced by TEST_CASE().