2021-03-10 22:51:50 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-08-24 04:25:17 +08:00
|
|
|
#include <string>
|
|
|
|
|
|
2022-06-11 16:38:24 -07:00
|
|
|
#include "system/hardware/base.h"
|
2022-05-18 14:11:57 -07:00
|
|
|
#include "common/util.h"
|
2021-03-24 11:09:39 -07:00
|
|
|
|
2022-04-18 17:55:23 -07:00
|
|
|
#if QCOM2
|
2022-06-11 16:38:24 -07:00
|
|
|
#include "system/hardware/tici/hardware.h"
|
2021-03-10 22:51:50 -08:00
|
|
|
#define Hardware HardwareTici
|
|
|
|
|
#else
|
2022-11-30 15:36:25 -08:00
|
|
|
#include "system/hardware/pc/hardware.h"
|
2021-05-06 14:39:05 +02:00
|
|
|
#define Hardware HardwarePC
|
2021-03-10 22:51:50 -08:00
|
|
|
#endif
|
2021-08-04 19:29:03 +08:00
|
|
|
|
|
|
|
|
namespace Path {
|
2023-09-07 11:32:47 -07:00
|
|
|
inline std::string openpilot_prefix() {
|
|
|
|
|
return util::getenv("OPENPILOT_PREFIX", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::string comma_home() {
|
|
|
|
|
return util::getenv("HOME") + "/.comma" + Path::openpilot_prefix();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::string log_root() {
|
|
|
|
|
if (const char *env = getenv("LOG_ROOT")) {
|
|
|
|
|
return env;
|
|
|
|
|
}
|
|
|
|
|
return Hardware::PC() ? Path::comma_home() + "/media/0/realdata" : "/data/media/0/realdata";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::string params() {
|
2024-01-18 20:12:04 -08:00
|
|
|
return util::getenv("PARAMS_ROOT", Hardware::PC() ? (Path::comma_home() + "/params") : "/data/params");
|
2023-09-07 11:32:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::string rsa_file() {
|
|
|
|
|
return Hardware::PC() ? Path::comma_home() + "/persist/comma/id_rsa" : "/persist/comma/id_rsa";
|
|
|
|
|
}
|
2024-01-18 20:04:08 -08:00
|
|
|
|
2023-09-07 11:32:47 -07:00
|
|
|
inline std::string swaglog_ipc() {
|
|
|
|
|
return "ipc:///tmp/logmessage" + Path::openpilot_prefix();
|
2021-08-04 19:29:03 +08:00
|
|
|
}
|
2023-09-07 12:49:03 -07:00
|
|
|
|
|
|
|
|
inline std::string download_cache_root() {
|
|
|
|
|
if (const char *env = getenv("COMMA_CACHE")) {
|
|
|
|
|
return env;
|
|
|
|
|
}
|
|
|
|
|
return "/tmp/comma_download_cache" + Path::openpilot_prefix() + "/";
|
|
|
|
|
}
|
2021-08-04 19:29:03 +08:00
|
|
|
} // namespace Path
|