(360/PS3) Use rarch_create_default_config_file

This commit is contained in:
Twinaphex 2012-05-28 16:50:18 +02:00
parent c9ce831e22
commit 15b7e0fafc
4 changed files with 17 additions and 23 deletions

View File

@ -190,12 +190,7 @@ static void init_settings (bool load_libretro_path)
char fname_tmp[MAX_PATH_LENGTH];
if(!path_file_exists(SYS_CONFIG_FILE))
{
FILE * f;
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
rarch_create_default_config_file(SYS_CONFIG_FILE);
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
@ -281,11 +276,7 @@ static void init_settings (bool load_libretro_path)
static void save_settings (void)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
rarch_create_default_config_file(SYS_CONFIG_FILE);
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);

View File

@ -789,3 +789,15 @@ const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr)
wcstombs(str, wstr, sizeof(str));
return str;
}
/*============================================================
CONFIG
============================================================ */
void rarch_create_default_config_file(const char * conf_name)
{
FILE * f;
RARCH_WARN("Config file \"%s\" doesn't exist. Creating...\n", conf_name);
f = fopen(conf_name, "w");
fclose(f);
}

View File

@ -138,5 +138,6 @@ wchar_t * rarch_convert_char_to_wchar(const char * str);
const char * rarch_convert_wchar_to_const_char(const wchar_t * wstr);
void rarch_create_default_config_file(const char * conf_name);
#endif

View File

@ -158,12 +158,7 @@ static void set_default_settings(void)
static void init_settings(bool load_libretro_path)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
rarch_create_default_config_file(SYS_CONFIG_FILE);
else
{
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);
@ -251,12 +246,7 @@ static void init_settings(bool load_libretro_path)
static void save_settings(void)
{
if(!path_file_exists(SYS_CONFIG_FILE))
{
RARCH_ERR("Config file \"%s\" doesn't exist. Creating...\n", SYS_CONFIG_FILE);
FILE * f;
f = fopen(SYS_CONFIG_FILE, "w");
fclose(f);
}
rarch_create_default_config_file(SYS_CONFIG_FILE);
else
{
config_file_t * conf = config_file_new(SYS_CONFIG_FILE);