Expose config load as a global function.

This commit is contained in:
Themaister 2012-01-28 15:41:57 +01:00
parent f3d9588e37
commit 57fbad1a54
2 changed files with 14 additions and 3 deletions

View File

@ -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[]);

View File

@ -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()");
}
}