mirror of
https://gitee.com/openharmony/distributedhardware_distributed_hardware_fwk
synced 2024-11-23 07:40:26 +00:00
修改配置文件获取失败
Signed-off-by: litiangang4 <litiangang4@huawei.com>
This commit is contained in:
parent
73b506a596
commit
14caafd39c
@ -71,7 +71,7 @@ namespace DistributedHardware {
|
||||
constexpr const char *EVENT_RUN = "EventRun";
|
||||
constexpr const char *START_EVENT = "StartEvent";
|
||||
constexpr const char *COMPONENTSLOAD_PROFILE_PATH =
|
||||
R"(etc/distributedhardware/distributed_hardware_components_cfg.json)";
|
||||
"etc/distributedhardware/distributed_hardware_components_cfg.json";
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
@ -351,12 +351,13 @@ int32_t ComponentLoader::ParseConfig()
|
||||
int32_t ret;
|
||||
DHLOGI("ParseConfig start");
|
||||
char buf[MAX_PATH_LEN] = {0};
|
||||
char path[PATH_MAX + 1] = {0x00};
|
||||
char *profilePath = GetOneCfgFile(COMPONENTSLOAD_PROFILE_PATH, buf, MAX_PATH_LEN);
|
||||
if (profilePath == nullptr) {
|
||||
DHLOGE("profilePath is null!");
|
||||
if (strlen(profilePath) == 0 || strlen(profilePath) > PATH_MAX || realpath(profilePath, path) == nullptr) {
|
||||
DHLOGE("File connicailization failed.");
|
||||
return ERR_DH_FWK_LOADER_PROFILE_PATH_IS_NULL;
|
||||
}
|
||||
std::string componentProfilePath(profilePath);
|
||||
std::string componentProfilePath(path);
|
||||
std::string jsonStr = Readfile(componentProfilePath);
|
||||
if (jsonStr.length() == 0 || jsonStr.size() > MAX_MESSAGE_LEN) {
|
||||
DHLOGE("ConfigJson size is invalid!");
|
||||
|
Loading…
Reference in New Issue
Block a user