#include "helpers.hpp" #include #include #include namespace helpers { std::string get_env(const std::string_view name) { const char *env{std::getenv(name.data())}; // NOLINT(concurrency-mt-unsafe) if (env != nullptr) { return env; } return {}; } std::string get_config_file_path(const std::string_view filename) { auto path{helpers::get_env("XDG_CONFIG_HOME")}; if (path.empty()) { path = helpers::get_env("HOME"); if (!path.empty()) { path += "/.config"; } } if (!path.empty()) { path += "/"; } path += filename; return path; } } // namespace helpers