29 std::string actual_config_path =
"";
30 std::string relative_config_path = config_file;
33 relative_config_path =
"modules/perception/data/conf/" + config_file;
36 relative_config_path,
"APOLLO_CONF_PATH", &actual_config_path)) {
37 AERROR <<
"Failed to get config path of " << config_file <<
" please check "
38 <<
"if config exists or `APOLLO_CONF_PATH` environment variable has "
39 <<
"been set correctly.";
41 return actual_config_path;
45 std::string model_path =
"";
47 model_name,
"APOLLO_MODEL_PATH", &model_path)) {
48 AERROR <<
"Failed to get model path of " << model_name <<
" please check "
49 <<
"if model has been installed or `APOLLO_MODEL_PATH` environment "
50 <<
"variable has been set correctly.";
56 const std::string &file_name) {
58 if (model_path.empty()) {
61 return model_path +
"/" + file_name;
65 std::string actual_config_path =
"";
66 std::string relative_config_path = config_path;
69 relative_config_path =
"modules/" + config_path;
72 relative_config_path,
"APOLLO_CONF_PATH", &actual_config_path)) {
73 AERROR <<
"Failed to get config path of " << config_path <<
" please check "
74 <<
"if config exists or `APOLLO_CONF_PATH` environment variable has "
75 <<
"been set correctly.";
77 return actual_config_path;
81 const std::string &config_file) {
82 std::string absolute_config_path =
GetConfigPath(config_path);
83 std::string file_path =
bool GetFilePathWithEnv(const std::string &path, const std::string &env_var, std::string *file_path)
get file path, judgement priority:
std::string GetAbsolutePath(const std::string &prefix, const std::string &relative_path)
Get absolute path by concatenating prefix and relative_path.
std::string GetEnv(const std::string &var_name, const std::string &default_value="")
bool PathIsAbsolute(const std::string &path)
std::string GetConfigPath(const std::string &config_path)
Get the config path
std::string GetCommonConfigFile(const std::string &config_file)
Get the perception common config path
std::string GetModelFile(const std::string &model_name, const std::string &file_name)
Get the model file path by model path and file name
std::string GetConfigFile(const std::string &config_path, const std::string &config_file)
std::string GetModelPath(const std::string &model_name)
Get the model path by model name, search from APOLLO_MODEL_PATH