diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2021-11-23 23:48:26 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2021-11-23 23:48:26 +0100 |
| commit | 2722431ce919d5e780d01bd14b77fbc03d007f07 (patch) | |
| tree | 883e9bcdee307295d54adf4a4abf3c909228b292 /src | |
| parent | 86bb5d6cf52d1bcdc854eb30e9729d7425a9971b (diff) | |
Make config keep the absolute root to load relative files from
This means Config::get_path will continue to work even if we change
current directory in the process (when the path the config was loaded
from was relative).
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config.cc b/src/config.cc index 4d7cf52..515c1eb 100644 --- a/src/config.cc +++ b/src/config.cc @@ -128,7 +128,8 @@ std::unique_ptr<Config> load(Logger* logger, path.c_str(), strerror(errno)); return nullptr; } - auto root = path.parent_path(); + std::error_code err; + auto root = std::filesystem::absolute(path.parent_path(), err); std::unordered_map<std::string, std::string> data; std::string line; unsigned long num = 0; |
