Runloop content path cleanups
This commit is contained in:
parent
f9db98194b
commit
dc4dd657f9
43
runloop.c
43
runloop.c
|
@ -7867,7 +7867,10 @@ void runloop_path_set_basename(const char *path)
|
|||
"", sizeof(runloop_st->runtime_content_path_basename));
|
||||
#endif
|
||||
|
||||
if ((dst = strrchr(runloop_st->runtime_content_path_basename, '.')))
|
||||
/* Truncate path to last dot, but not when the path is
|
||||
* relative and begins with a dot. */
|
||||
if ( (dst = strrchr(runloop_st->runtime_content_path_basename, '.'))
|
||||
&& (dst - runloop_st->runtime_content_path_basename > 0))
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
|
@ -7919,10 +7922,10 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
char intermediate_savestate_dir[DIR_MAX_LENGTH];
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
struct retro_system_info *sysinfo = &runloop_st->system.info;
|
||||
bool sort_savefiles_enable = settings->bools.sort_savefiles_enable;
|
||||
bool sort_savefiles_by_content_enable = settings->bools.sort_savefiles_by_content_enable;
|
||||
bool sort_savestates_enable = settings->bools.sort_savestates_enable;
|
||||
bool sort_savestates_by_content_enable = settings->bools.sort_savestates_by_content_enable;
|
||||
bool sort_savefiles = settings->bools.sort_savefiles_enable;
|
||||
bool sort_savefiles_by_content = settings->bools.sort_savefiles_by_content_enable;
|
||||
bool sort_savestates = settings->bools.sort_savestates_enable;
|
||||
bool sort_savestates_by_content = settings->bools.sort_savestates_by_content_enable;
|
||||
bool savefiles_in_content_dir = settings->bools.savefiles_in_content_dir;
|
||||
bool savestates_in_content_dir = settings->bools.savestates_in_content_dir;
|
||||
|
||||
|
@ -7935,8 +7938,7 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
|
||||
/* Get content directory name, if per-content-directory
|
||||
* saves/states are enabled */
|
||||
if (( sort_savefiles_by_content_enable
|
||||
|| sort_savestates_by_content_enable)
|
||||
if ( (sort_savefiles_by_content || sort_savestates_by_content)
|
||||
&& !string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_parent_dir_name(content_dir_name,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
|
@ -7980,28 +7982,29 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
#endif
|
||||
{
|
||||
/* Per-core and/or per-content-directory saves */
|
||||
if ((sort_savefiles_enable
|
||||
|| sort_savefiles_by_content_enable)
|
||||
if ( (sort_savefiles || sort_savefiles_by_content)
|
||||
&& !string_is_empty(new_savefile_dir))
|
||||
{
|
||||
/* Append content directory name to save location */
|
||||
if (sort_savefiles_by_content_enable)
|
||||
fill_pathname_join_special(new_savefile_dir,
|
||||
if (sort_savefiles_by_content)
|
||||
fill_pathname_join_special(
|
||||
new_savefile_dir,
|
||||
intermediate_savefile_dir,
|
||||
content_dir_name,
|
||||
sizeof(new_savefile_dir));
|
||||
|
||||
/* Append library_name to the save location */
|
||||
if (sort_savefiles_enable)
|
||||
fill_pathname_join(new_savefile_dir,
|
||||
if (sort_savefiles)
|
||||
fill_pathname_join(
|
||||
new_savefile_dir,
|
||||
new_savefile_dir,
|
||||
sysinfo->library_name,
|
||||
sizeof(new_savefile_dir));
|
||||
|
||||
/* If path doesn't exist, try to create it,
|
||||
* if everything fails revert to the original path. */
|
||||
if (!path_is_directory(new_savefile_dir))
|
||||
if (!path_mkdir(new_savefile_dir))
|
||||
if ( !path_is_directory(new_savefile_dir)
|
||||
&& !path_mkdir(new_savefile_dir))
|
||||
{
|
||||
RARCH_LOG("%s %s\n",
|
||||
msg_hash_to_str(MSG_REVERTING_SAVEFILE_DIRECTORY_TO),
|
||||
|
@ -8013,11 +8016,11 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
}
|
||||
|
||||
/* Per-core and/or per-content-directory savestates */
|
||||
if ((sort_savestates_enable || sort_savestates_by_content_enable)
|
||||
if ( (sort_savestates || sort_savestates_by_content)
|
||||
&& !string_is_empty(new_savestate_dir))
|
||||
{
|
||||
/* Append content directory name to savestate location */
|
||||
if (sort_savestates_by_content_enable)
|
||||
if (sort_savestates_by_content)
|
||||
fill_pathname_join_special(
|
||||
new_savestate_dir,
|
||||
intermediate_savestate_dir,
|
||||
|
@ -8025,7 +8028,7 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
sizeof(new_savestate_dir));
|
||||
|
||||
/* Append library_name to the savestate location */
|
||||
if (sort_savestates_enable)
|
||||
if (sort_savestates)
|
||||
fill_pathname_join(
|
||||
new_savestate_dir,
|
||||
new_savestate_dir,
|
||||
|
@ -8034,8 +8037,8 @@ void runloop_path_set_redirect(settings_t *settings,
|
|||
|
||||
/* If path doesn't exist, try to create it.
|
||||
* If everything fails, revert to the original path. */
|
||||
if (!path_is_directory(new_savestate_dir))
|
||||
if (!path_mkdir(new_savestate_dir))
|
||||
if ( !path_is_directory(new_savestate_dir)
|
||||
&& !path_mkdir(new_savestate_dir))
|
||||
{
|
||||
RARCH_LOG("%s %s\n",
|
||||
msg_hash_to_str(MSG_REVERTING_SAVESTATE_DIRECTORY_TO),
|
||||
|
|
Loading…
Reference in New Issue