diff --git a/command.c b/command.c index 18e49c0084..d40ed14906 100644 --- a/command.c +++ b/command.c @@ -1702,6 +1702,37 @@ static bool command_event_resize_windowed_scale(void) return true; } +void command_playlist_push_write( + void *data, + const char *path, + const char *label, + const char *core_path, + const char *core_name) +{ + playlist_t *plist = (playlist_t*)data; + playlist_t *playlist = NULL; + + if (plist) + playlist = plist; +#ifdef HAVE_MENU + else + menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); +#endif + if (!playlist) + return; + + playlist_push( + playlist, + path, + label, + core_path, + core_name, + NULL, + NULL + ); + playlist_write_file(playlist); +} + void command_playlist_update_write( void *data, size_t idx, @@ -2304,16 +2335,13 @@ TODO: Add a setting for these tweaks */ if (!string_is_empty(global->name.label)) label = global->name.label; - playlist_push( + command_playlist_push_write( g_defaults.content_favorites, (const char*)data, label, core_path, - core_name, - NULL, - NULL + core_name ); - playlist_write_file(g_defaults.content_favorites); runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true); break; } diff --git a/command.h b/command.h index b0305d3526..286383fc83 100644 --- a/command.h +++ b/command.h @@ -259,6 +259,13 @@ bool command_free(command_t *handle); **/ bool command_event(enum event_command action, void *data); +void command_playlist_push_write( + void *data, + const char *path, + const char *label, + const char *core_path, + const char *core_name); + void command_playlist_update_write( void *data, size_t idx, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 66c9b2d977..af7c5dda31 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1804,16 +1804,12 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path, fill_pathname_join(combined_path, menu->scratch2_buf, menu->scratch_buf, sizeof(combined_path)); - playlist_push( + command_playlist_push_write( g_defaults.music_history, combined_path, NULL, "builtin", - "musicplayer", - NULL, - NULL); - - playlist_write_file(g_defaults.music_history); + "musicplayer"); if(path_file_exists(combined_path)) task_push_audio_mixer_load(combined_path,