mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
file_archive_get_file_list_cb - remove string_list usage
This commit is contained in:
parent
1ef4be2280
commit
29c89a46f1
@ -55,39 +55,45 @@ static int file_archive_get_file_list_cb(
|
||||
|
||||
if (valid_exts)
|
||||
{
|
||||
size_t path_len = strlen(path);
|
||||
/* Checks if this entry is a directory or a file. */
|
||||
char last_char = path[path_len - 1];
|
||||
struct string_list ext_list = {0};
|
||||
char *tok, *save;
|
||||
bool found_ext = false;
|
||||
char *valid_exts_cpy = NULL;
|
||||
size_t path_len = 0;
|
||||
char last_char = 0;
|
||||
const char *file_ext = path_get_extension(path);
|
||||
|
||||
if (!file_ext)
|
||||
return 1;
|
||||
|
||||
path_len = strlen(path);
|
||||
last_char = path[path_len - 1];
|
||||
|
||||
/* Checks if this entry is a directory or a file. */
|
||||
/* Skip if directory. */
|
||||
if (last_char == '/' || last_char == '\\')
|
||||
return 1;
|
||||
|
||||
string_list_initialize(&ext_list);
|
||||
if (string_split_noalloc(&ext_list, valid_exts, "|"))
|
||||
{
|
||||
const char *file_ext = path_get_extension(path);
|
||||
valid_exts_cpy = strdup(valid_exts);
|
||||
tok = strtok_r(valid_exts_cpy, "|", &save);
|
||||
|
||||
if (!file_ext)
|
||||
while (tok)
|
||||
{
|
||||
string_list_deinitialize(&ext_list);
|
||||
return 1;
|
||||
if (string_is_equal_noncase(tok, file_ext))
|
||||
{
|
||||
found_ext = true;
|
||||
break;
|
||||
}
|
||||
tok = strtok_r(NULL, "|", &save);
|
||||
}
|
||||
free(valid_exts_cpy);
|
||||
|
||||
if (!string_list_find_elem_prefix(&ext_list, ".", file_ext))
|
||||
{
|
||||
/* keep iterating */
|
||||
string_list_deinitialize(&ext_list);
|
||||
if (!found_ext)
|
||||
return -1;
|
||||
}
|
||||
|
||||
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
||||
}
|
||||
|
||||
string_list_deinitialize(&ext_list);
|
||||
}
|
||||
|
||||
return string_list_append(userdata->list, path, attr);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user