|
|
@ -60,9 +60,9 @@ bool create_params_path(const std::string ¶m_path, const std::string &key_pa |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string ensure_params_path(const std::string &path = {}) { |
|
|
|
std::string ensure_params_path(const std::string &prefix, const std::string &path = {}) { |
|
|
|
std::string params_path = path.empty() ? Path::params() : path; |
|
|
|
std::string params_path = path.empty() ? Path::params() : path; |
|
|
|
if (!create_params_path(params_path, params_path + "/d")) { |
|
|
|
if (!create_params_path(params_path, params_path + prefix)) { |
|
|
|
throw std::runtime_error(util::string_format("Failed to ensure params path, errno=%d", errno)); |
|
|
|
throw std::runtime_error(util::string_format("Failed to ensure params path, errno=%d", errno)); |
|
|
|
} |
|
|
|
} |
|
|
|
return params_path; |
|
|
|
return params_path; |
|
|
@ -180,9 +180,12 @@ std::unordered_map<std::string, uint32_t> keys = { |
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Params::Params(const std::string &path) { |
|
|
|
Params::Params(const std::string &path) { |
|
|
|
static std::string default_param_path = ensure_params_path(); |
|
|
|
const char* env = std::getenv("OPENPILOT_PREFIX"); |
|
|
|
params_path = path.empty() ? default_param_path : ensure_params_path(path); |
|
|
|
prefix = env ? "/" + std::string(env) : "/d"; |
|
|
|
|
|
|
|
std::string default_param_path = ensure_params_path(prefix); |
|
|
|
|
|
|
|
params_path = path.empty() ? default_param_path : ensure_params_path(prefix, path); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Params::checkKey(const std::string &key) { |
|
|
|
bool Params::checkKey(const std::string &key) { |
|
|
|