add function sf_set_global_base_path

iovec_array
YuQing 2021-05-25 18:48:33 +08:00
parent 561b7c8d7c
commit 5befb9d616
2 changed files with 7 additions and 2 deletions

View File

@ -236,8 +236,7 @@ int sf_load_global_config_ex(const char *server_name,
"\"base_path\"!", __LINE__, ini_ctx->filename); "\"base_path\"!", __LINE__, ini_ctx->filename);
return ENOENT; return ENOENT;
} }
snprintf(SF_G_BASE_PATH, sizeof(SF_G_BASE_PATH), "%s", pBasePath); sf_set_global_base_path(pBasePath);
g_sf_global_vars.base_path.inited = true;
} }
chopPath(SF_G_BASE_PATH); chopPath(SF_G_BASE_PATH);

View File

@ -199,6 +199,12 @@ void sf_log_config_ex(const char *other_config);
#define sf_log_config_to_string(log_cfg, caption, output, size) \ #define sf_log_config_to_string(log_cfg, caption, output, size) \
sf_log_config_to_string_ex(log_cfg, caption, NULL, output, size) sf_log_config_to_string_ex(log_cfg, caption, NULL, output, size)
static inline void sf_set_global_base_path(const char *base_path)
{
snprintf(SF_G_BASE_PATH, sizeof(SF_G_BASE_PATH), "%s", base_path);
g_sf_global_vars.base_path.inited = true;
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif