mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
add comments and make it create the directories if they don't exist
This commit is contained in:
parent
90b0136e06
commit
336e28fc34
@ -492,6 +492,7 @@ static void event_deinit_core(bool reinit)
|
||||
if (reinit)
|
||||
event_command(EVENT_CMD_DRIVERS_DEINIT);
|
||||
|
||||
/* auto overrides: reload the original config */
|
||||
if(global->overrides_active)
|
||||
{
|
||||
config_unload_override();
|
||||
@ -658,9 +659,11 @@ static bool event_init_core(void)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* per-core saves: save the original path */
|
||||
strlcpy(orig_savefile_dir,global->savefile_dir,sizeof(orig_savefile_dir));
|
||||
strlcpy(orig_savestate_dir,global->savestate_dir,sizeof(orig_savestate_dir));
|
||||
|
||||
/* auto overrides: apply overrides */
|
||||
if(settings->auto_overrides_enable)
|
||||
{
|
||||
if (config_load_override())
|
||||
@ -671,9 +674,11 @@ static bool event_init_core(void)
|
||||
|
||||
pretro_set_environment(rarch_environment_cb);
|
||||
|
||||
/* auto-remap: apply remap files */
|
||||
if(settings->auto_remaps_enable)
|
||||
config_load_remap();
|
||||
|
||||
/* per-core saves: reset redirection paths */
|
||||
if(settings->sort_savestates_enable || settings->sort_savefiles_enable)
|
||||
set_paths_redirect(global->basename);
|
||||
|
||||
@ -689,6 +694,7 @@ static bool event_init_core(void)
|
||||
retro_init_libretro_cbs(&driver->retro_ctx);
|
||||
rarch_init_system_av_info();
|
||||
|
||||
/* per-core saves: restore the original path so the config is not affected */
|
||||
if(settings->sort_savefiles_enable)
|
||||
strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
|
||||
if(settings->sort_savestates_enable)
|
||||
|
12
retroarch.c
12
retroarch.c
@ -331,16 +331,28 @@ void set_paths_redirect(const char *path)
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* per-core saves: append the library_name to the save location */
|
||||
if(global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savefiles_enable)
|
||||
{
|
||||
strlcpy(orig_savefile_dir,global->savefile_dir,sizeof(global->savefile_dir));
|
||||
fill_pathname_dir(global->savefile_dir,global->savefile_dir,global->system.info.library_name,sizeof(global->savefile_dir));
|
||||
|
||||
// if path doesn't exist try to create it, if everything fails revert to the original path
|
||||
if(!path_is_directory(global->savefile_dir))
|
||||
if(!path_mkdir(global->savefile_dir))
|
||||
strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
|
||||
}
|
||||
|
||||
/* per-core states: append the library_name to the save location */
|
||||
if (global->system.info.library_name && strcmp(global->system.info.library_name,"No Core") && settings->sort_savestates_enable)
|
||||
{
|
||||
strlcpy(orig_savestate_dir,global->savestate_dir,sizeof(global->savestate_dir));
|
||||
fill_pathname_dir(global->savestate_dir,global->savestate_dir,global->system.info.library_name,sizeof(global->savestate_dir));
|
||||
|
||||
// if path doesn't exist try to create it, if everything fails revert to the original path
|
||||
if(!path_is_directory(global->savestate_dir))
|
||||
if(!path_mkdir(global->savestate_dir))
|
||||
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
|
||||
}
|
||||
|
||||
if(path_is_directory(global->savefile_dir))
|
||||
|
Loading…
x
Reference in New Issue
Block a user