clean up #ifdef HAVE_COCOATOUCH blocks related to playlist and replace with appropriate call to playlist_resolve_path()

This commit is contained in:
Yoshi Sugawara 2019-07-20 12:16:04 -10:00
parent 388c4857d3
commit 81c8aad119

View File

@ -1882,8 +1882,7 @@ static int action_ok_playlist_entry_collection(const char *path,
if (tmp_playlist)
{
struct playlist_entry entry = {0};
entry.core_path = new_core_path;
entry.core_path = (char*)default_core_path;
entry.core_name = core_info.inf->display_name;
command_playlist_update_write(
@ -1929,11 +1928,6 @@ static int action_ok_playlist_entry(const char *path,
new_core_path[0] = '\0';
#ifdef HAVE_COCOATOUCH
char expanded_core_path[PATH_MAX_LENGTH];
expanded_core_path[0] = '\0';
#endif
if (!playlist ||
!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
@ -1955,6 +1949,7 @@ static int action_ok_playlist_entry(const char *path,
if (!string_is_empty(default_core_path))
{
strlcpy(new_core_path, default_core_path, sizeof(new_core_path));
playlist_resolve_path(PLAYLIST_LOAD, new_core_path, sizeof(new_core_path));
found_associated_core = true;
}
@ -1973,7 +1968,7 @@ static int action_ok_playlist_entry(const char *path,
{
struct playlist_entry entry = {0};
entry.core_path = new_core_path;
entry.core_path = (char*)default_core_path;
entry.core_name = core_info.inf->display_name;
command_playlist_update_write(NULL,
@ -1984,10 +1979,7 @@ static int action_ok_playlist_entry(const char *path,
}
else if (!string_is_empty(entry->core_path)) {
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
#ifdef HAVE_COCOATOUCH
fill_pathname_expand_special(expanded_core_path, new_core_path, sizeof(expanded_core_path));
strlcpy(new_core_path, expanded_core_path, sizeof(new_core_path));
#endif
playlist_resolve_path(PLAYLIST_LOAD, new_core_path, sizeof(new_core_path));
}
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
@ -2870,6 +2862,7 @@ static int action_ok_core_deferred_set(const char *new_core_path,
{
char ext_name[255];
char core_display_name[PATH_MAX_LENGTH];
char resolved_core_path[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
menu_handle_t *menu = NULL;
@ -2878,6 +2871,7 @@ static int action_ok_core_deferred_set(const char *new_core_path,
ext_name[0] = '\0';
core_display_name[0] = '\0';
resolved_core_path[0] = '\0';
msg[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
@ -2894,18 +2888,14 @@ static int action_ok_core_deferred_set(const char *new_core_path,
settings->bools.show_hidden_files,
true);
strlcpy(resolved_core_path, new_core_path, sizeof(resolved_core_path));
playlist_resolve_path(PLAYLIST_SAVE, resolved_core_path, sizeof(resolved_core_path));
/* the update function reads our entry
* as const, so these casts are safe */
entry.core_path = (char*)new_core_path;
entry.core_path = (char*)resolved_core_path;
entry.core_name = core_display_name;
#ifdef HAVE_COCOATOUCH
// for iOS, change abbreviate the bundle path with ":" because bundle path changes on each install
char abbreviated_core_path[PATH_MAX_LENGTH] = {0};
fill_pathname_abbreviate_special(abbreviated_core_path, new_core_path, sizeof(abbreviated_core_path));
entry.core_path = abbreviated_core_path;
#endif
command_playlist_update_write(
NULL,
menu->scratchpad.unsigned_var,