Built-in playlist path rework
This commit is contained in:
parent
db5c4d2758
commit
383daa31cb
312
configuration.c
312
configuration.c
|
@ -2745,6 +2745,30 @@ static void video_driver_default_settings(global_t *global)
|
|||
global->console.screen.resolutions.current.id = 0;
|
||||
}
|
||||
|
||||
/* Moves built-in playlists from legacy location to 'playlists/builtin' */
|
||||
#define CONFIG_PLAYLIST_MIGRATION(playlist_path, playlist_tag) \
|
||||
{ \
|
||||
char new_file[PATH_MAX_LENGTH]; \
|
||||
fill_pathname_resolve_relative( \
|
||||
playlist_path, \
|
||||
path_config, \
|
||||
playlist_tag, \
|
||||
sizeof(playlist_path)); \
|
||||
fill_pathname_join_special( \
|
||||
new_file, \
|
||||
new_path, \
|
||||
playlist_tag, \
|
||||
sizeof(tmp_str)); \
|
||||
if (path_is_valid(playlist_path)) \
|
||||
{ \
|
||||
rename(playlist_path, new_file); \
|
||||
if (!path_is_valid(new_file)) \
|
||||
new_file[0] = '\0'; \
|
||||
} \
|
||||
if (!string_is_empty(new_file)) \
|
||||
strlcpy(playlist_path, new_file, sizeof(playlist_path)); \
|
||||
} \
|
||||
|
||||
/**
|
||||
* config_set_defaults:
|
||||
*
|
||||
|
@ -2978,6 +3002,13 @@ void config_set_defaults(void *data)
|
|||
settings->uints.microphone_latency = g_defaults.settings_in_latency;
|
||||
#endif
|
||||
|
||||
configuration_set_string(settings,
|
||||
settings->arrays.midi_input,
|
||||
DEFAULT_MIDI_INPUT);
|
||||
configuration_set_string(settings,
|
||||
settings->arrays.midi_output,
|
||||
DEFAULT_MIDI_OUTPUT);
|
||||
|
||||
#ifdef HAVE_LAKKA
|
||||
configuration_set_bool(settings,
|
||||
settings->bools.ssh_enable, filestream_exists(LAKKA_SSH_PATH));
|
||||
|
@ -3281,12 +3312,110 @@ void config_set_defaults(void *data)
|
|||
path_set(RARCH_PATH_CONFIG, temp_str);
|
||||
}
|
||||
|
||||
configuration_set_string(settings,
|
||||
settings->arrays.midi_input,
|
||||
DEFAULT_MIDI_INPUT);
|
||||
configuration_set_string(settings,
|
||||
settings->arrays.midi_output,
|
||||
DEFAULT_MIDI_OUTPUT);
|
||||
/* Built-in playlist default paths,
|
||||
* needed when creating a new cfg from scratch */
|
||||
{
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
|
||||
fill_pathname_join_special(
|
||||
new_path,
|
||||
settings->paths.directory_playlist,
|
||||
FILE_PATH_BUILTIN,
|
||||
sizeof(new_path));
|
||||
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_favorites))
|
||||
strlcpy(settings->paths.directory_content_favorites, "default",
|
||||
sizeof(settings->paths.directory_content_favorites));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_favorites)
|
||||
|| string_is_equal(settings->paths.directory_content_favorites, "default"))
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_favorites,
|
||||
new_path,
|
||||
FILE_PATH_CONTENT_FAVORITES,
|
||||
sizeof(settings->paths.path_content_favorites));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_favorites,
|
||||
settings->paths.directory_content_favorites,
|
||||
FILE_PATH_CONTENT_FAVORITES,
|
||||
sizeof(settings->paths.path_content_favorites));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_history))
|
||||
strlcpy(settings->paths.directory_content_history, "default",
|
||||
sizeof(settings->paths.directory_content_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_history)
|
||||
|| string_is_equal(settings->paths.directory_content_history, "default"))
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_history,
|
||||
new_path,
|
||||
FILE_PATH_CONTENT_HISTORY,
|
||||
sizeof(settings->paths.path_content_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_history,
|
||||
settings->paths.directory_content_history,
|
||||
FILE_PATH_CONTENT_HISTORY,
|
||||
sizeof(settings->paths.path_content_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_image_history))
|
||||
strlcpy(settings->paths.directory_content_image_history, "default",
|
||||
sizeof(settings->paths.directory_content_image_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_image_history)
|
||||
|| string_is_equal(settings->paths.directory_content_image_history, "default"))
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_image_history,
|
||||
new_path,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY,
|
||||
sizeof(settings->paths.path_content_image_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_image_history,
|
||||
settings->paths.directory_content_image_history,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY,
|
||||
sizeof(settings->paths.path_content_image_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_music_history))
|
||||
strlcpy(settings->paths.directory_content_music_history, "default",
|
||||
sizeof(settings->paths.directory_content_music_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_music_history)
|
||||
|| string_is_equal(settings->paths.directory_content_music_history, "default"))
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_music_history,
|
||||
new_path,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY,
|
||||
sizeof(settings->paths.path_content_music_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_music_history,
|
||||
settings->paths.directory_content_music_history,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY,
|
||||
sizeof(settings->paths.path_content_music_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_video_history))
|
||||
strlcpy(settings->paths.directory_content_video_history, "default",
|
||||
sizeof(settings->paths.directory_content_video_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_video_history)
|
||||
|| string_is_equal(settings->paths.directory_content_video_history, "default"))
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_video_history,
|
||||
new_path,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY,
|
||||
sizeof(settings->paths.path_content_video_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_video_history,
|
||||
settings->paths.directory_content_video_history,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY,
|
||||
sizeof(settings->paths.path_content_video_history));
|
||||
}
|
||||
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
/* Avoid reloading config on every content load */
|
||||
|
@ -3632,7 +3761,6 @@ static bool config_load_file(global_t *global,
|
|||
unsigned msg_color = 0;
|
||||
char *save = NULL;
|
||||
char *override_username = NULL;
|
||||
const char *path_config = NULL;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
|
||||
int float_settings_size = sizeof(settings->floats) / sizeof(settings->floats.placeholder);
|
||||
|
@ -4008,97 +4136,105 @@ static bool config_load_file(global_t *global,
|
|||
settings->arrays.midi_output,
|
||||
DEFAULT_MIDI_OUTPUT);
|
||||
|
||||
path_config = path_get(RARCH_PATH_CONFIG);
|
||||
/* Built-in playlist default legacy path migration */
|
||||
{
|
||||
const char *path_config = path_get(RARCH_PATH_CONFIG);
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_favorites))
|
||||
strlcpy(settings->paths.directory_content_favorites, "default",
|
||||
sizeof(settings->paths.directory_content_favorites));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_favorites)
|
||||
|| string_is_equal(settings->paths.directory_content_favorites, "default"))
|
||||
fill_pathname_resolve_relative(
|
||||
settings->paths.path_content_favorites,
|
||||
path_config,
|
||||
FILE_PATH_CONTENT_FAVORITES,
|
||||
sizeof(settings->paths.path_content_favorites));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_favorites,
|
||||
settings->paths.directory_content_favorites,
|
||||
FILE_PATH_CONTENT_FAVORITES,
|
||||
sizeof(settings->paths.path_content_favorites));
|
||||
new_path,
|
||||
settings->paths.directory_playlist,
|
||||
FILE_PATH_BUILTIN,
|
||||
sizeof(new_path));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_history))
|
||||
strlcpy(settings->paths.directory_content_history, "default",
|
||||
sizeof(settings->paths.directory_content_history));
|
||||
if (!path_is_directory(new_path))
|
||||
path_mkdir(new_path);
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_history)
|
||||
|| string_is_equal(settings->paths.directory_content_history, "default"))
|
||||
fill_pathname_resolve_relative(
|
||||
settings->paths.path_content_history,
|
||||
path_config,
|
||||
FILE_PATH_CONTENT_HISTORY,
|
||||
sizeof(settings->paths.path_content_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_history,
|
||||
settings->paths.directory_content_history,
|
||||
FILE_PATH_CONTENT_HISTORY,
|
||||
sizeof(settings->paths.path_content_history));
|
||||
if (string_is_empty(settings->paths.path_content_favorites))
|
||||
strlcpy(settings->paths.directory_content_favorites, "default",
|
||||
sizeof(settings->paths.directory_content_favorites));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_image_history))
|
||||
strlcpy(settings->paths.directory_content_image_history, "default",
|
||||
sizeof(settings->paths.directory_content_image_history));
|
||||
if ( string_is_empty(settings->paths.directory_content_favorites)
|
||||
|| string_is_equal(settings->paths.directory_content_favorites, "default"))
|
||||
{
|
||||
CONFIG_PLAYLIST_MIGRATION(settings->paths.path_content_favorites,
|
||||
FILE_PATH_CONTENT_FAVORITES);
|
||||
}
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_favorites,
|
||||
settings->paths.directory_content_favorites,
|
||||
FILE_PATH_CONTENT_FAVORITES,
|
||||
sizeof(settings->paths.path_content_favorites));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_image_history)
|
||||
|| string_is_equal(settings->paths.directory_content_image_history, "default"))
|
||||
fill_pathname_resolve_relative(
|
||||
settings->paths.path_content_image_history,
|
||||
path_config,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY,
|
||||
sizeof(settings->paths.path_content_image_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_image_history,
|
||||
settings->paths.directory_content_image_history,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY,
|
||||
sizeof(settings->paths.path_content_image_history));
|
||||
if (string_is_empty(settings->paths.path_content_history))
|
||||
strlcpy(settings->paths.directory_content_history, "default",
|
||||
sizeof(settings->paths.directory_content_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_music_history))
|
||||
strlcpy(settings->paths.directory_content_music_history, "default",
|
||||
sizeof(settings->paths.directory_content_music_history));
|
||||
if ( string_is_empty(settings->paths.directory_content_history)
|
||||
|| string_is_equal(settings->paths.directory_content_history, "default"))
|
||||
{
|
||||
CONFIG_PLAYLIST_MIGRATION(settings->paths.path_content_history,
|
||||
FILE_PATH_CONTENT_HISTORY);
|
||||
}
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_history,
|
||||
settings->paths.directory_content_history,
|
||||
FILE_PATH_CONTENT_HISTORY,
|
||||
sizeof(settings->paths.path_content_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_music_history)
|
||||
|| string_is_equal(settings->paths.directory_content_music_history, "default"))
|
||||
fill_pathname_resolve_relative(
|
||||
settings->paths.path_content_music_history,
|
||||
path_config,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY,
|
||||
sizeof(settings->paths.path_content_music_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_music_history,
|
||||
settings->paths.directory_content_music_history,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY,
|
||||
sizeof(settings->paths.path_content_music_history));
|
||||
if (string_is_empty(settings->paths.path_content_image_history))
|
||||
strlcpy(settings->paths.directory_content_image_history, "default",
|
||||
sizeof(settings->paths.directory_content_image_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_video_history))
|
||||
strlcpy(settings->paths.directory_content_video_history, "default",
|
||||
sizeof(settings->paths.directory_content_video_history));
|
||||
if ( string_is_empty(settings->paths.directory_content_image_history)
|
||||
|| string_is_equal(settings->paths.directory_content_image_history, "default"))
|
||||
{
|
||||
CONFIG_PLAYLIST_MIGRATION(settings->paths.path_content_image_history,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY);
|
||||
}
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_image_history,
|
||||
settings->paths.directory_content_image_history,
|
||||
FILE_PATH_CONTENT_IMAGE_HISTORY,
|
||||
sizeof(settings->paths.path_content_image_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_video_history)
|
||||
|| string_is_equal(settings->paths.directory_content_video_history, "default"))
|
||||
fill_pathname_resolve_relative(
|
||||
settings->paths.path_content_video_history,
|
||||
path_config,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY,
|
||||
sizeof(settings->paths.path_content_video_history));
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_video_history,
|
||||
settings->paths.directory_content_video_history,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY,
|
||||
sizeof(settings->paths.path_content_video_history));
|
||||
if (string_is_empty(settings->paths.path_content_music_history))
|
||||
strlcpy(settings->paths.directory_content_music_history, "default",
|
||||
sizeof(settings->paths.directory_content_music_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_music_history)
|
||||
|| string_is_equal(settings->paths.directory_content_music_history, "default"))
|
||||
{
|
||||
CONFIG_PLAYLIST_MIGRATION(settings->paths.path_content_music_history,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY);
|
||||
}
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_music_history,
|
||||
settings->paths.directory_content_music_history,
|
||||
FILE_PATH_CONTENT_MUSIC_HISTORY,
|
||||
sizeof(settings->paths.path_content_music_history));
|
||||
|
||||
if (string_is_empty(settings->paths.path_content_video_history))
|
||||
strlcpy(settings->paths.directory_content_video_history, "default",
|
||||
sizeof(settings->paths.directory_content_video_history));
|
||||
|
||||
if ( string_is_empty(settings->paths.directory_content_video_history)
|
||||
|| string_is_equal(settings->paths.directory_content_video_history, "default"))
|
||||
{
|
||||
CONFIG_PLAYLIST_MIGRATION(settings->paths.path_content_video_history,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY);
|
||||
}
|
||||
else
|
||||
fill_pathname_join_special(
|
||||
settings->paths.path_content_video_history,
|
||||
settings->paths.directory_content_video_history,
|
||||
FILE_PATH_CONTENT_VIDEO_HISTORY,
|
||||
sizeof(settings->paths.path_content_video_history));
|
||||
}
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_screenshot))
|
||||
{
|
||||
|
|
42
playlist.c
42
playlist.c
|
@ -963,7 +963,7 @@ bool playlist_push_runtime(playlist_t *playlist,
|
|||
|
||||
if (string_is_empty(entry->core_path))
|
||||
{
|
||||
RARCH_ERR("Cannot push NULL or empty core path into the playlist.\n");
|
||||
RARCH_ERR("[Playlist]: Cannot push NULL or empty core path into the playlist.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -980,7 +980,7 @@ bool playlist_push_runtime(playlist_t *playlist,
|
|||
|
||||
if (string_is_empty(real_core_path))
|
||||
{
|
||||
RARCH_ERR("Cannot push NULL or empty core path into the playlist.\n");
|
||||
RARCH_ERR("[Playlist]: Cannot push NULL or empty core path into the playlist.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ bool playlist_push(playlist_t *playlist,
|
|||
|
||||
if (string_is_empty(entry->core_path))
|
||||
{
|
||||
RARCH_ERR("Cannot push NULL or empty core path into the playlist.\n");
|
||||
RARCH_ERR("[Playlist]: Cannot push NULL or empty core path into the playlist.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ bool playlist_push(playlist_t *playlist,
|
|||
|
||||
if (string_is_empty(real_core_path))
|
||||
{
|
||||
RARCH_ERR("Cannot push NULL or empty core path into the playlist.\n");
|
||||
RARCH_ERR("[Playlist]: Cannot push NULL or empty core path into the playlist.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ bool playlist_push(playlist_t *playlist,
|
|||
|
||||
if (string_is_empty(core_name))
|
||||
{
|
||||
RARCH_ERR("Cannot push NULL or empty core name into the playlist.\n");
|
||||
RARCH_ERR("[Playlist]: Cannot push NULL or empty core name into the playlist.\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -1558,13 +1558,13 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
|||
if (!(file = intfstream_open_file(playlist->config.path,
|
||||
RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE)))
|
||||
{
|
||||
RARCH_ERR("Failed to write to playlist file: \"%s\".\n", playlist->config.path);
|
||||
RARCH_ERR("[Playlist]: Failed to write to file: \"%s\".\n", playlist->config.path);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(writer = rjsonwriter_open_stream(file)))
|
||||
{
|
||||
RARCH_ERR("Failed to create JSON writer\n");
|
||||
RARCH_ERR("[Playlist]: Failed to create JSON writer\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1697,7 +1697,7 @@ void playlist_write_runtime_file(playlist_t *playlist)
|
|||
| CNT_PLAYLIST_FLG_OLD_FMT
|
||||
| CNT_PLAYLIST_FLG_COMPRESSED);
|
||||
|
||||
RARCH_LOG("[Playlist]: Written to playlist file: \"%s\".\n", playlist->config.path);
|
||||
RARCH_LOG("[Playlist]: Written to file: \"%s\".\n", playlist->config.path);
|
||||
end:
|
||||
intfstream_close(file);
|
||||
free(file);
|
||||
|
@ -1720,11 +1720,13 @@ void playlist_write_file(playlist_t *playlist)
|
|||
bool pl_old_fmt = ((playlist->flags & CNT_PLAYLIST_FLG_OLD_FMT) > 0);
|
||||
|
||||
if ( !playlist
|
||||
|| !((playlist->flags & CNT_PLAYLIST_FLG_MOD)
|
||||
|| string_is_empty(playlist->config.path)
|
||||
|| !( (playlist->flags & CNT_PLAYLIST_FLG_MOD)
|
||||
#if defined(HAVE_ZLIB)
|
||||
|| (pl_compressed != playlist->config.compress)
|
||||
|| (pl_compressed != playlist->config.compress)
|
||||
#endif
|
||||
|| (pl_old_fmt != playlist->config.old_format)))
|
||||
|| (pl_old_fmt != playlist->config.old_format)
|
||||
))
|
||||
return;
|
||||
|
||||
#if defined(HAVE_ZLIB)
|
||||
|
@ -1739,7 +1741,7 @@ void playlist_write_file(playlist_t *playlist)
|
|||
|
||||
if (!file)
|
||||
{
|
||||
RARCH_ERR("Failed to write to playlist file: \"%s\".\n", playlist->config.path);
|
||||
RARCH_ERR("[Playlist]: Failed to write to file: \"%s\".\n", playlist->config.path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1784,7 +1786,7 @@ void playlist_write_file(playlist_t *playlist)
|
|||
rjsonwriter_t* writer = rjsonwriter_open_stream(file);
|
||||
if (!writer)
|
||||
{
|
||||
RARCH_ERR("Failed to create JSON writer\n");
|
||||
RARCH_ERR("[Playlist]: Failed to create JSON writer\n");
|
||||
goto end;
|
||||
}
|
||||
/* When compressing playlists, human readability
|
||||
|
@ -2088,7 +2090,7 @@ void playlist_write_file(playlist_t *playlist)
|
|||
|
||||
if (!rjsonwriter_free(writer))
|
||||
{
|
||||
RARCH_ERR("Failed to write to playlist file: \"%s\".\n", playlist->config.path);
|
||||
RARCH_ERR("[Playlist]: Failed to write to file: \"%s\".\n", playlist->config.path);
|
||||
}
|
||||
|
||||
playlist->flags &= ~(CNT_PLAYLIST_FLG_OLD_FMT);
|
||||
|
@ -2101,7 +2103,7 @@ void playlist_write_file(playlist_t *playlist)
|
|||
else
|
||||
playlist->flags &= ~(CNT_PLAYLIST_FLG_COMPRESSED);
|
||||
|
||||
RARCH_LOG("[Playlist]: Written to playlist file: \"%s\".\n", playlist->config.path);
|
||||
RARCH_LOG("[Playlist]: Written to file: \"%s\".\n", playlist->config.path);
|
||||
end:
|
||||
intfstream_close(file);
|
||||
free(file);
|
||||
|
@ -2268,7 +2270,7 @@ static bool JSONStartObjectHandler(void *context)
|
|||
/* Hit max item limit.
|
||||
* Note: We can't just abort here, since there may
|
||||
* be more metadata to read at the end of the file... */
|
||||
RARCH_WARN("JSON file contains more entries than current playlist capacity. Excess entries will be discarded.\n");
|
||||
RARCH_WARN("[Playlist]: JSON file contains more entries than current playlist capacity. Excess entries will be discarded.\n");
|
||||
pCtx->flags |= JSON_CTX_FLG_CAPACITY_EXCEEDED;
|
||||
pCtx->current_entry = NULL;
|
||||
/* In addition, since we are discarding excess entries,
|
||||
|
@ -2625,7 +2627,7 @@ static bool playlist_read_file(playlist_t *playlist)
|
|||
|
||||
if (!(parser = rjson_open_stream(file)))
|
||||
{
|
||||
RARCH_ERR("Failed to create JSON parser\n");
|
||||
RARCH_ERR("[Playlist]: Failed to create JSON parser\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -2649,15 +2651,15 @@ static bool playlist_read_file(playlist_t *playlist)
|
|||
{
|
||||
if (context.flags & JSON_CTX_FLG_OOM)
|
||||
{
|
||||
RARCH_WARN("Ran out of memory while parsing JSON playlist\n");
|
||||
RARCH_WARN("[Playlist]: Ran out of memory while parsing JSON playlist\n");
|
||||
res = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_WARN("Error parsing chunk:\n---snip---\n%.*s\n---snip---\n",
|
||||
RARCH_WARN("[Playlist]: Error parsing chunk:\n---snip---\n%.*s\n---snip---\n",
|
||||
rjson_get_source_context_len(parser),
|
||||
rjson_get_source_context_buf(parser));
|
||||
RARCH_WARN("Error: Invalid JSON at line %d, column %d - %s.\n",
|
||||
RARCH_WARN("[Playlist]: Error: Invalid JSON at line %d, column %d - %s.\n",
|
||||
(int)rjson_get_source_line(parser),
|
||||
(int)rjson_get_source_column(parser),
|
||||
(*rjson_get_error(parser) ? rjson_get_error(parser) : "format error"));
|
||||
|
|
73
retroarch.c
73
retroarch.c
|
@ -4122,36 +4122,48 @@ bool command_event(enum event_command cmd, void *data)
|
|||
|
||||
/* Note: Sorting is disabled by default for
|
||||
* all content history playlists */
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_history);
|
||||
g_defaults.content_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.content_history, PLAYLIST_SORT_MODE_OFF);
|
||||
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_music_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_music_history);
|
||||
g_defaults.music_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.music_history, PLAYLIST_SORT_MODE_OFF);
|
||||
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_video_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_video_history);
|
||||
g_defaults.video_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.video_history, PLAYLIST_SORT_MODE_OFF);
|
||||
#endif
|
||||
if (!string_is_empty(path_content_history))
|
||||
{
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_history);
|
||||
g_defaults.content_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.content_history, PLAYLIST_SORT_MODE_OFF);
|
||||
}
|
||||
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_image_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_image_history);
|
||||
g_defaults.image_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.image_history, PLAYLIST_SORT_MODE_OFF);
|
||||
if (!string_is_empty(path_content_image_history))
|
||||
{
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_image_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_image_history);
|
||||
g_defaults.image_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.image_history, PLAYLIST_SORT_MODE_OFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(path_content_music_history))
|
||||
{
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_music_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_music_history);
|
||||
g_defaults.music_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.music_history, PLAYLIST_SORT_MODE_OFF);
|
||||
}
|
||||
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
if (!string_is_empty(path_content_video_history))
|
||||
{
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n", _msg,
|
||||
path_content_video_history);
|
||||
playlist_config_set_path(&playlist_config, path_content_video_history);
|
||||
g_defaults.video_history = playlist_init(&playlist_config);
|
||||
playlist_set_sort_mode(
|
||||
g_defaults.video_history, PLAYLIST_SORT_MODE_OFF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
@ -4665,7 +4677,8 @@ bool command_event(enum event_command cmd, void *data)
|
|||
settings->paths.directory_menu_config,
|
||||
as_path, sizeof(conf_path));
|
||||
|
||||
path_set(RARCH_PATH_CONFIG, conf_path);
|
||||
if (!string_is_empty(conf_path))
|
||||
path_set(RARCH_PATH_CONFIG, conf_path);
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
command_event_save_current_config(OVERRIDE_NONE);
|
||||
#endif
|
||||
|
@ -8737,7 +8750,7 @@ void retroarch_favorites_init(void)
|
|||
|
||||
retroarch_favorites_deinit();
|
||||
|
||||
if (!playlist_config.capacity)
|
||||
if (!playlist_config.capacity || string_is_empty(path_content_favorites))
|
||||
return;
|
||||
|
||||
RARCH_LOG("[Playlist]: %s: \"%s\".\n",
|
||||
|
|
|
@ -1490,8 +1490,8 @@ static bool content_load(content_ctx_info_t *info,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
command_event(CMD_EVENT_HISTORY_INIT, NULL);
|
||||
retroarch_favorites_init();
|
||||
command_event(CMD_EVENT_HISTORY_INIT, NULL);
|
||||
command_event(CMD_EVENT_RESUME, NULL);
|
||||
command_event(CMD_EVENT_VIDEO_SET_ASPECT_RATIO, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue