diff --git a/dllexports/awtk.def b/dllexports/awtk.def index 983feb01c..383a910fe 100644 --- a/dllexports/awtk.def +++ b/dllexports/awtk.def @@ -2013,6 +2013,7 @@ EXPORTS system_info_init system_info_deinit system_info_set_font_scale + system_info_set_app_root system_info_set_default_font system_info_set_lcd_w system_info_set_lcd_h diff --git a/src/base/system_info.c b/src/base/system_info.c index f1f60dd6b..033c56e87 100644 --- a/src/base/system_info.c +++ b/src/base/system_info.c @@ -47,9 +47,9 @@ static bool_t app_root_is_valid(const char* app_root) { return path_exist(res_root); } -static ret_t system_info_set_app_root(system_info_t* info, const char* app_root) { +ret_t system_info_set_app_root(system_info_t* info, const char* app_root) { if (app_root != NULL) { - info->app_root = tk_strdup(app_root); + info->app_root = tk_str_copy(info->app_root, app_root); log_debug("app_root=%s\n", app_root); } diff --git a/src/base/system_info.h b/src/base/system_info.h index b2ffdd53d..508a3b048 100644 --- a/src/base/system_info.h +++ b/src/base/system_info.h @@ -171,6 +171,17 @@ ret_t system_info_deinit(void); */ ret_t system_info_set_font_scale(system_info_t* info, float_t font_scale); +/** + * @method system_info_set_app_root + * 设置app root。 + * + * @param {system_info_t* info} info system_info对象。 + * @param {const char*} app_root app root。 + * + * @return {ret_t} 返回RET_OK表示成功,否则表示失败。 + */ +ret_t system_info_set_app_root(system_info_t* info, const char* app_root); + /** * @method system_info_set_default_font * 设置缺省字体。 diff --git a/tools/idl_gen/idl.json b/tools/idl_gen/idl.json index 9cfea4620..847150df0 100644 --- a/tools/idl_gen/idl.json +++ b/tools/idl_gen/idl.json @@ -60641,6 +60641,27 @@ "desc": "返回RET_OK表示成功,否则表示失败。" } }, + { + "params": [ + { + "type": "system_info_t* info", + "name": "info", + "desc": "system_info对象。" + }, + { + "type": "const char*", + "name": "app_root", + "desc": "app root。" + } + ], + "annotation": {}, + "desc": "设置app root。", + "name": "system_info_set_app_root", + "return": { + "type": "ret_t", + "desc": "返回RET_OK表示成功,否则表示失败。" + } + }, { "params": [ {