From 57fbad1a541cd30d87cc21b3e65c84f15b92b783 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 28 Jan 2012 15:41:57 +0100 Subject: [PATCH] Expose config load as a global function. --- general.h | 3 +++ settings.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/general.h b/general.h index 361fd9d768..c0e11810b7 100644 --- a/general.h +++ b/general.h @@ -374,6 +374,9 @@ struct global void parse_config(void); void config_set_defaults(void); +#ifdef HAVE_CONFIGFILE +void config_load_file(const char *path); +#endif void ssnes_main_clear_state(void); int ssnes_main_init(int argc, char *argv[]); diff --git a/settings.c b/settings.c index 3bb5371be3..c93d5701c1 100644 --- a/settings.c +++ b/settings.c @@ -314,15 +314,23 @@ static config_file_t *open_default_config_file(void) #ifdef HAVE_CONFIGFILE static void parse_config_file(void) +{ + if (*g_extern.config_path) + config_load_file(g_extern.config_path); + else + config_load_file(NULL); +} + +void config_load_file(const char *path) { config_file_t *conf = NULL; - if (*g_extern.config_path) + if (path) { - conf = config_file_new(g_extern.config_path); + conf = config_file_new(path); if (!conf) { - SSNES_ERR("Couldn't find config at path: \"%s\"\n", g_extern.config_path); + SSNES_ERR("Couldn't find config at path: \"%s\"\n", path); ssnes_fail(1, "parse_config_file()"); } }