mirror of https://github.com/commaai/openpilot.git
params: specify path using PARAMS_ROOT (#28257)
* Add PARAMS_ROOT env var * Change getenv type signature * Use getenv default_val
This commit is contained in:
parent
3785e161f0
commit
b43a875ba2
|
@ -189,7 +189,7 @@ bool create_directories(const std::string& dir, mode_t mode) {
|
||||||
return createDirectory(dir, mode);
|
return createDirectory(dir, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getenv(const char* key, const char* default_val) {
|
std::string getenv(const char* key, std::string default_val) {
|
||||||
const char* val = ::getenv(key);
|
const char* val = ::getenv(key);
|
||||||
return val ? val : default_val;
|
return val ? val : default_val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ std::string string_format(const std::string& format, Args... args) {
|
||||||
return std::string(buf.get(), buf.get() + size - 1);
|
return std::string(buf.get(), buf.get() + size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getenv(const char* key, const char* default_val = "");
|
std::string getenv(const char* key, std::string default_val = "");
|
||||||
int getenv(const char* key, int default_val);
|
int getenv(const char* key, int default_val);
|
||||||
float getenv(const char* key, float default_val);
|
float getenv(const char* key, float default_val);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ inline std::string log_root() {
|
||||||
return Hardware::PC() ? util::getenv("HOME") + "/.comma/media/0/realdata" : "/data/media/0/realdata";
|
return Hardware::PC() ? util::getenv("HOME") + "/.comma/media/0/realdata" : "/data/media/0/realdata";
|
||||||
}
|
}
|
||||||
inline std::string params() {
|
inline std::string params() {
|
||||||
return Hardware::PC() ? util::getenv("HOME") + "/.comma/params" : "/data/params";
|
return Hardware::PC() ? util::getenv("PARAMS_ROOT", util::getenv("HOME") + "/.comma/params") : "/data/params";
|
||||||
}
|
}
|
||||||
inline std::string rsa_file() {
|
inline std::string rsa_file() {
|
||||||
return Hardware::PC() ? util::getenv("HOME") + "/.comma/persist/comma/id_rsa" : "/persist/comma/id_rsa";
|
return Hardware::PC() ? util::getenv("HOME") + "/.comma/persist/comma/id_rsa" : "/persist/comma/id_rsa";
|
||||||
|
|
Loading…
Reference in New Issue