mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-21 18:21:51 +00:00
Rewrite core_info_get_custom_config
This commit is contained in:
parent
2b87db4e51
commit
cc3835c915
@ -792,8 +792,9 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
|
||||
{
|
||||
const core_info_t *tmp = (const core_info_t*)core_info_list_get_by_id(core.UTF8String);
|
||||
self.title = tmp ? BOXSTRING(tmp->display_name) : BOXSTRING(core.UTF8String);
|
||||
|
||||
_pathToSave = BOXSTRING(core_info_get_custom_config(core.UTF8String, buffer, sizeof(buffer)));
|
||||
|
||||
core_info_get_custom_config(core.UTF8String, buffer, sizeof(buffer));
|
||||
_pathToSave = BOXSTRING(buffer);
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteCustom)];
|
||||
}
|
||||
else
|
||||
@ -986,9 +987,7 @@ static bool copy_config(const char *src_path, const char *dst_path)
|
||||
if (g_defaults.config_path[0] != '\0' && path[0] != '\0')
|
||||
{
|
||||
if (!copy_config(g_defaults.config_path, path))
|
||||
{
|
||||
RARCH_WARN("Could not create custom config at %s.", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
18
core_info.c
18
core_info.c
@ -456,22 +456,26 @@ const core_info_t *core_info_list_get_by_id(const char *core_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *core_info_get_custom_config(const char *core_id, char *buffer, size_t buffer_length)
|
||||
void core_info_get_custom_config(const char *core_id, char *buf, size_t sizeof_buf)
|
||||
{
|
||||
if (!core_id || !buffer || !buffer_length)
|
||||
return 0;
|
||||
if (!core_id || !buf || !sizeof_buf)
|
||||
return;
|
||||
|
||||
fill_pathname_join(buffer, g_defaults.menu_config_dir, path_basename(core_id), buffer_length);
|
||||
fill_pathname(buffer, buffer, ".cfg", buffer_length);
|
||||
return buffer;
|
||||
fill_pathname_join(buf, g_defaults.menu_config_dir, path_basename(core_id), sizeof_buf);
|
||||
fill_pathname(buf, buf, ".cfg", sizeof_buf);
|
||||
}
|
||||
|
||||
bool core_info_has_custom_config(const char *core_id)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (!core_id)
|
||||
return false;
|
||||
|
||||
core_info_get_custom_config(core_id, path, sizeof(path));
|
||||
return path_file_exists(path);
|
||||
|
||||
if (path[0] != '\0')
|
||||
return path_file_exists(path);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void core_info_set_core_path(void);
|
||||
core_info_list_t *core_info_list_get(void);
|
||||
const core_info_t *core_info_list_get_by_id(const char *core_id);
|
||||
|
||||
const char *core_info_get_custom_config(const char *core_id, char *buffer, size_t buffer_length);
|
||||
void core_info_get_custom_config(const char *core_id, char *buf, size_t sizeof_buf);
|
||||
bool core_info_has_custom_config(const char *core_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user