Merge pull request #1723 from fr500/master

fix per-core savedirs for content that needs_fullpath
This commit is contained in:
Twinaphex 2015-05-26 02:11:42 +02:00
commit fd59696f8f
2 changed files with 12 additions and 11 deletions

View File

@ -482,6 +482,7 @@ static void event_init_controllers(void)
static void event_deinit_core(bool reinit) static void event_deinit_core(bool reinit)
{ {
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
pretro_unload_game(); pretro_unload_game();
pretro_deinit(); pretro_deinit();
@ -489,7 +490,13 @@ static void event_deinit_core(bool reinit)
if (reinit) if (reinit)
event_command(EVENT_CMD_DRIVERS_DEINIT); event_command(EVENT_CMD_DRIVERS_DEINIT);
/* auto overrides: reload the original config */ /* 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)
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
/* auto overrides: reload the original config */
if(global->overrides_active) if(global->overrides_active)
{ {
config_unload_override(); config_unload_override();
@ -691,12 +698,6 @@ static bool event_init_core(void)
retro_init_libretro_cbs(&driver->retro_ctx); retro_init_libretro_cbs(&driver->retro_ctx);
rarch_init_system_av_info(); 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)
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
return true; return true;
} }

View File

@ -275,8 +275,8 @@ void set_paths_redirect(const char *path)
strlcpy(orig_savefile_dir,global->savefile_dir,sizeof(global->savefile_dir)); 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)); 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 doesn't exist try to create it, if everything fails revert to the original path
if(!path_is_directory(global->savefile_dir)) if(!path_is_directory(global->savefile_dir))
if(!path_mkdir(global->savefile_dir)) if(!path_mkdir(global->savefile_dir))
strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir)); strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
} }
@ -287,8 +287,8 @@ void set_paths_redirect(const char *path)
strlcpy(orig_savestate_dir,global->savestate_dir,sizeof(global->savestate_dir)); 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)); 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 doesn't exist try to create it, if everything fails revert to the original path
if(!path_is_directory(global->savestate_dir)) if(!path_is_directory(global->savestate_dir))
if(!path_mkdir(global->savestate_dir)) if(!path_mkdir(global->savestate_dir))
strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir)); strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir));
} }