mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Core Info: Use basename when searching core paths (fixes issues when core directory is on a symlinked filesystem)
This commit is contained in:
parent
fa5f2c61c3
commit
9bcc80320d
@ -539,6 +539,7 @@ static core_info_t *core_info_find_internal(
|
|||||||
const char *core)
|
const char *core)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
const char *core_path_basename = path_basename(core);
|
||||||
|
|
||||||
for (i = 0; i < list->count; i++)
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
@ -546,7 +547,7 @@ static core_info_t *core_info_find_internal(
|
|||||||
|
|
||||||
if (!info || !info->path)
|
if (!info || !info->path)
|
||||||
continue;
|
continue;
|
||||||
if (string_is_equal(info->path, core))
|
if (string_is_equal(path_basename(info->path), core_path_basename))
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,6 +807,8 @@ void core_info_get_name(const char *path, char *s, size_t len,
|
|||||||
path_info : dir_cores;
|
path_info : dir_cores;
|
||||||
struct string_list *contents = dir_list_new(
|
struct string_list *contents = dir_list_new(
|
||||||
dir_cores, exts, false, dir_show_hidden_files, false, false);
|
dir_cores, exts, false, dir_show_hidden_files, false, false);
|
||||||
|
const char *core_path_basename = path_basename(path);
|
||||||
|
|
||||||
if (!contents)
|
if (!contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -817,7 +820,7 @@ void core_info_get_name(const char *path, char *s, size_t len,
|
|||||||
char *new_core_name = NULL;
|
char *new_core_name = NULL;
|
||||||
const char *current_path = contents->elems[i].data;
|
const char *current_path = contents->elems[i].data;
|
||||||
|
|
||||||
if (!string_is_equal(current_path, path))
|
if (!string_is_equal(path_basename(current_path), core_path_basename))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
info_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
@ -273,6 +273,7 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path)
|
|||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
core_info_list_t *core_info = NULL;
|
core_info_list_t *core_info = NULL;
|
||||||
runtime_log_t *runtime_log = NULL;
|
runtime_log_t *runtime_log = NULL;
|
||||||
|
const char *core_path_basename = path_basename(core_path);
|
||||||
|
|
||||||
char content_name[PATH_MAX_LENGTH];
|
char content_name[PATH_MAX_LENGTH];
|
||||||
char core_name[PATH_MAX_LENGTH];
|
char core_name[PATH_MAX_LENGTH];
|
||||||
@ -298,7 +299,7 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string_is_empty(content_path) || string_is_empty(core_path))
|
if (string_is_empty(content_path) || string_is_empty(core_path_basename))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (string_is_equal(core_path, "builtin") || string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)))
|
if (string_is_equal(core_path, "builtin") || string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)))
|
||||||
@ -312,7 +313,7 @@ runtime_log_t *runtime_log_init(const char *content_path, const char *core_path)
|
|||||||
|
|
||||||
for (i = 0; i < core_info->count; i++)
|
for (i = 0; i < core_info->count; i++)
|
||||||
{
|
{
|
||||||
if (string_is_equal(core_info->list[i].path, core_path))
|
if (string_is_equal(path_basename(core_info->list[i].path), core_path_basename))
|
||||||
{
|
{
|
||||||
strlcpy(core_name, core_info->list[i].core_name, sizeof(core_name));
|
strlcpy(core_name, core_info->list[i].core_name, sizeof(core_name));
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user