From af93ece15469c06b7beeaf783652aaa7c14ebd99 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net> Date: Tue, 19 Feb 2019 13:03:49 +0700 Subject: [PATCH] [+] dap_config_path() --- core/dap_config.c | 8 +++++++- core/dap_config.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/dap_config.c b/core/dap_config.c index 44bba00..ffa5d39 100755 --- a/core/dap_config.c +++ b/core/dap_config.c @@ -58,13 +58,19 @@ int dap_config_init(const char * a_configs_path) } #endif if(dir_test(a_configs_path) || !mkdir_with_parents(a_configs_path)) { - strcpy(s_configs_path, a_configs_path); + strncpy(s_configs_path, a_configs_path,sizeof(s_configs_path)); return 0; } } return -1; } +const char * dap_config_path() +{ + return s_configs_path; +} + + /** * @brief dap_config_deinit Deinitialize settings */ diff --git a/core/dap_config.h b/core/dap_config.h index 7d64f59..d7d03b2 100755 --- a/core/dap_config.h +++ b/core/dap_config.h @@ -43,6 +43,8 @@ void dap_config_deinit(); dap_config_t * dap_config_open(const char * a_name); void dap_config_close(dap_config_t * a_config); +const char * dap_config_path(); + int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); int32_t dap_config_get_item_int32_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, int32_t a_default); const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); -- GitLab