Skip to content

Commit 01a3511

Browse files
committed
iOS: rely on core info to re-find cores from old directory structure
1 parent 86f63e1 commit 01a3511

File tree

3 files changed

+15
-44
lines changed

3 files changed

+15
-44
lines changed

core_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ static size_t core_info_get_file_id(const char *core_filename,
15711571
&& !string_is_equal(last_underscore, "_libretro"))
15721572
{
15731573
*last_underscore = '\0';
1574-
_len = strlen(s); /* TODO/FIXME - make this unnecessary later on */
1574+
_len = last_underscore - s;
15751575
}
15761576
return _len;
15771577
}

menu/cbs/menu_cbs_ok.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,15 +2835,13 @@ static int action_ok_playlist_entry_collection(const char *path,
28352835
}
28362836
else
28372837
{
2838-
#ifndef IOS
28392838
core_info = playlist_entry_get_core_info(entry);
28402839

28412840
if (core_info && !string_is_empty(core_info->path))
28422841
strlcpy(core_path, core_info->path, sizeof(core_path));
28432842
else
28442843
/* Core path is invalid - just copy what we have
28452844
* and hope for the best... */
2846-
#endif
28472845
{
28482846
strlcpy(core_path, entry->core_path, sizeof(core_path));
28492847
playlist_resolve_path(PLAYLIST_LOAD, true, core_path, sizeof(core_path));

playlist.c

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,58 +1144,31 @@ enum playlist_thumbnail_name_flags playlist_get_next_thumbnail_name_flag(playlis
11441144
void playlist_resolve_path(enum playlist_file_mode mode,
11451145
bool is_core, char *s, size_t len)
11461146
{
1147+
bool resolve_symlinks = true;
1148+
11471149
#if IOS
11481150
char tmp[PATH_MAX_LENGTH];
1149-
int _len = 0;
11501151

11511152
if (mode == PLAYLIST_LOAD)
11521153
{
1153-
if ( is_core
1154-
&& string_starts_with(s, ":/modules/")
1155-
&& string_ends_with(s, ".dylib"))
1156-
{
1157-
/* iOS cores used to be packaged as .dylib files in the modules
1158-
* directory; App Store rules require turning them into Frameworks and
1159-
* putting them in the Frameworks directory. Because some playlists
1160-
* include the old core path, we'll translate it here.
1161-
*/
1162-
s[string_index_last_occurance(s, '.')] = '\0';
1163-
if (string_ends_with(s, "_ios"))
1164-
s[string_index_last_occurance(s, '_')] = '\0';
1165-
_len += strlcpy(tmp + _len, ":/Frameworks/", STRLEN_CONST(":/Frameworks/") + 1);
1166-
_len += strlcpy(tmp + _len, s + STRLEN_CONST(":/modules/"), sizeof(tmp) - _len);
1167-
/* iOS framework names, to quote Apple:
1168-
* "must contain only alphanumerics, dots, hyphens and must not end with a dot."
1169-
*
1170-
* Since core names include underscore, which is not allowed, but not dot,
1171-
* which is, we change underscore to dot.
1172-
*/
1173-
string_replace_all_chars(tmp, '_', '.');
1174-
strlcpy(tmp + _len, ".framework", sizeof(tmp));
1175-
fill_pathname_expand_special(s, tmp, len);
1176-
}
1177-
else
1178-
{
1179-
fill_pathname_expand_special(tmp, s, sizeof(tmp));
1180-
strlcpy(s, tmp, len);
1181-
}
1154+
/* This is probably safe for all platforms, it should end up being just a
1155+
* lot of string copies without changing it */
1156+
fill_pathname_expand_special(tmp, s, sizeof(tmp));
1157+
strlcpy(s, tmp, len);
11821158
}
11831159
else
11841160
{
1185-
/* iOS needs to call realpath here since the call
1186-
* above fails due to possibly buffer related issues.
1187-
* Try to expand the path to ensure that it gets saved
1188-
* correctly. The path can be abbreviated if saving to
1189-
* a playlist from another playlist (ex: content history to favorites)
1190-
*/
1191-
char tmp2[PATH_MAX_LENGTH];
1161+
/* Try to expand the path to ensure that it gets saved correctly. The path
1162+
* can be abbreviated if saving to a playlist from another playlist (ex:
1163+
* content history to favorites). This is probably safe for all
1164+
* platforms */
11921165
fill_pathname_expand_special(tmp, s, sizeof(tmp));
1193-
realpath(tmp, tmp2);
1194-
fill_pathname_abbreviate_special(s, tmp2, len);
1166+
path_resolve_realpath(tmp, sizeof(tmp), resolve_symlinks);
1167+
/* iOS requries this because the full path can change after app update;
1168+
* it's probably safe for all platforms... */
1169+
fill_pathname_abbreviate_special(s, tmp, len);
11951170
}
11961171
#else
1197-
bool resolve_symlinks = true;
1198-
11991172
if (mode == PLAYLIST_LOAD)
12001173
return;
12011174

0 commit comments

Comments
 (0)