README.md
1# Config Policy
2
3## Introduction
4
5The config policy, namely, cust, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths.
6
7## Directory Structure
8
9The directory structure for the config policy is as follows:
10
11```
12/base/customization/
13├── config_policy # Code repository for the config policy
14│ ├── frameworks # Core code of the config policy
15│ │ ├── config_policy # config policy
16│ │ │ └── src # Implementation code
17│ ├── interfaces # APIs of the config policy
18│ │ ├── inner_api # APIs of the config policy for internal subsystems
19│ │ └── kits # JavaScript APIs
20│ └── test # Test code
21```
22
23## Usage
24
25Call the APIs of the config policy to obtain the configuration directories at different levels or the configuration file paths.
26
27```
28#include "config_policy_utils.h"
29
30const char *testPathSuffix = "user.xml"; // Set the name of the configuration file.
31char buf[MAX_PATH_LEN] = {0};
32char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); // Obtain the path of the configuration file with the highest priority.
33```
34
35## Constraints
36
37**Programming language**: C/C++
38
39## Repositories Involved
40
41**customization\_config\_policy**
42
43
README_zh.md
1# 配置策略组件介绍
2
3## 简介
4
5配置策略组件为各业务模块提供获取各配置层级的配置目录或配置文件路径的接口。
6
7## 系统架构
8
9**图 1** 配置策略组件架构图
10
11
12
13配置策略组件架构图说明:
14
15- interfaces对外提供指定文件的最高优先级文件路径以及指定文件所有层级路径。
16- frameworks实现配置层级目录的初始化与文件路径查询。
17
18## 目录
19
20配置策略组件源代码目录结构如下所示:
21
22```
23/base/customization/
24├── config_policy # 配置策略代码仓
25│ ├── frameworks # 配置策略核心代码
26│ │ ├── config_policy # 配置策略模块
27│ │ │ └── src # 实现代码
28│ ├── interfaces # 配置策略接口
29│ │ ├── inner_api # 子系统间接口
30│ │ └── kits # 配置策略JavaScript接口
31│ └── test # 测试代码
32```
33
34## 说明
35
36调用该组件中的接口获取各配置层级的配置目录或配置文件路径。
37
38```
39#include "config_policy_utils.h"
40
41const char *testPathSuffix = "user.xml"; //设置配置文件名称
42char buf[MAX_PATH_LEN] = {0};
43char *filePath = GetOneCfgFile(testPathSuffix, buf, MAX_PATH_LEN); //获取最高优先级的配置文件路径
44```
45
46## 约束
47
48**语言限制**:C/C++语言
49
50## 相关仓
51
52**customization\_config\_policy**
53
54