improve cross-platform support for thumbnail filenames

The intention of this PR is to allow RetroArch playlists to display the 'prohibited' characters & \ / ? : < > : * | on the screen, while searching for matching thumbnail files that replace these problematic characters with an underscore. This step of the process is bolded in the flowchart below as #2 under 'Playlist display.'

I don't normally work in C -- this change is a hack job. It did look like string_replace_substring could handle being daisy-chained so I thought I'd see if this could spark a productive conversation.

Playlist generation:
    1) Use hash values to match ROM files to known-good databases such as No-Intro. (exists)
    2) Create playlist using 'display names' from the known-good databases (exists)

Playlist display:
    1) Read display name from the playlist file (exists)
    **2) Transform characters that are not cross-platform friendly into underscores to determine thumb filename (this PR)**
    3) Look for a thumbnail file that matches this filename (exists)
    4) Display the thumbnail image (exists)
This commit is contained in:
markwkidd 2016-11-14 13:24:05 -05:00 committed by GitHub
parent 35b2980de9
commit a9ead799e6

View File

@ -861,8 +861,17 @@ static void xmb_update_thumbnail_path(void *data, unsigned i)
fill_pathname_join(xmb->thumbnail_file_path, xmb->thumbnail_file_path,
xmb_thumbnails_ident(), sizeof(xmb->thumbnail_file_path));
tmp = string_replace_substring(entry.path, "/", "-");
tmp = string_replace_substring(entry.path, "&", "_");
tmp = string_replace_substring(entry.path, "\", "_");
tmp = string_replace_substring(entry.path, "/", "_");
tmp = string_replace_substring(entry.path, "?", "_");
tmp = string_replace_substring(entry.path, ":", "_");
tmp = string_replace_substring(entry.path, "<", "_");
tmp = string_replace_substring(entry.path, ">", "_");
tmp = string_replace_substring(entry.path, ":", "_");
tmp = string_replace_substring(entry.path, "*", "_");
tmp = string_replace_substring(entry.path, "|", "_");
if (tmp)
{
char tmp_new[PATH_MAX_LENGTH];