Join core info lists with new string_list_join_concat().
This commit is contained in:
parent
86fa251cd5
commit
6e42f4485d
16
file_path.c
16
file_path.c
|
@ -211,6 +211,22 @@ bool string_list_append(struct string_list *list, const char *elem, union string
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void string_list_join_concat(char *buffer, size_t size, const struct string_list *list, const char *sep)
|
||||||
|
{
|
||||||
|
size_t len = strlen(buffer);
|
||||||
|
rarch_assert(len < size);
|
||||||
|
buffer += len;
|
||||||
|
size -= len;
|
||||||
|
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < list->size; i++)
|
||||||
|
{
|
||||||
|
strlcat(buffer, list->elems[i].data, size);
|
||||||
|
if ((i + 1) < list->size)
|
||||||
|
strlcat(buffer, sep, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct string_list *string_split(const char *str, const char *delim)
|
struct string_list *string_split(const char *str, const char *delim)
|
||||||
{
|
{
|
||||||
char *copy = NULL;
|
char *copy = NULL;
|
||||||
|
|
|
@ -60,6 +60,7 @@ struct string_list *string_split(const char *str, const char *delim);
|
||||||
struct string_list *string_list_new(void);
|
struct string_list *string_list_new(void);
|
||||||
bool string_list_append(struct string_list *list, const char *elem, union string_list_elem_attr attr);
|
bool string_list_append(struct string_list *list, const char *elem, union string_list_elem_attr attr);
|
||||||
void string_list_free(struct string_list *list);
|
void string_list_free(struct string_list *list);
|
||||||
|
void string_list_join_concat(char *buffer, size_t size, const struct string_list *list, const char *sep);
|
||||||
|
|
||||||
bool path_is_directory(const char *path);
|
bool path_is_directory(const char *path);
|
||||||
bool path_file_exists(const char *path);
|
bool path_file_exists(const char *path);
|
||||||
|
|
|
@ -1933,17 +1933,26 @@ void menu_populate_entries(void *data, unsigned menu_type)
|
||||||
rgui->core_info_current.display_name ? rgui->core_info_current.display_name : "");
|
rgui->core_info_current.display_name ? rgui->core_info_current.display_name : "");
|
||||||
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Authors: %s",
|
if (rgui->core_info_current.authors_list)
|
||||||
rgui->core_info_current.authors ? rgui->core_info_current.authors : "");
|
{
|
||||||
|
strlcpy(tmp, "Authors: ", sizeof(tmp));
|
||||||
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.authors_list, ", ");
|
||||||
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Permissions: %s",
|
if (rgui->core_info_current.permissions_list)
|
||||||
rgui->core_info_current.permissions ? rgui->core_info_current.permissions : "");
|
{
|
||||||
|
strlcpy(tmp, "Permissions: ", sizeof(tmp));
|
||||||
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.permissions_list, ", ");
|
||||||
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "Supported extensions: %s",
|
if (rgui->core_info_current.supported_extensions_list)
|
||||||
rgui->core_info_current.supported_extensions ? rgui->core_info_current.supported_extensions : "");
|
{
|
||||||
|
strlcpy(tmp, "Supported extensions: ", sizeof(tmp));
|
||||||
|
string_list_join_concat(tmp, sizeof(tmp), rgui->core_info_current.supported_extensions_list, ", ");
|
||||||
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
file_list_push(rgui->selection_buf, tmp, RGUI_SETTINGS_CORE_INFO_NONE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (rgui->core_info_current.firmware_count > 0)
|
if (rgui->core_info_current.firmware_count > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue