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)
|
if (valid_exts)
|
||||||
{
|
{
|
||||||
size_t path_len = strlen(path);
|
char *tok, *save;
|
||||||
/* Checks if this entry is a directory or a file. */
|
bool found_ext = false;
|
||||||
char last_char = path[path_len - 1];
|
char *valid_exts_cpy = NULL;
|
||||||
struct string_list ext_list = {0};
|
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. */
|
/* Skip if directory. */
|
||||||
if (last_char == '/' || last_char == '\\')
|
if (last_char == '/' || last_char == '\\')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
string_list_initialize(&ext_list);
|
valid_exts_cpy = strdup(valid_exts);
|
||||||
if (string_split_noalloc(&ext_list, valid_exts, "|"))
|
tok = strtok_r(valid_exts_cpy, "|", &save);
|
||||||
{
|
|
||||||
const char *file_ext = path_get_extension(path);
|
|
||||||
|
|
||||||
if (!file_ext)
|
while (tok)
|
||||||
{
|
{
|
||||||
string_list_deinitialize(&ext_list);
|
if (string_is_equal_noncase(tok, file_ext))
|
||||||
return 1;
|
{
|
||||||
|
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 */
|
/* keep iterating */
|
||||||
string_list_deinitialize(&ext_list);
|
if (!found_ext)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list_deinitialize(&ext_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
return string_list_append(userdata->list, path, attr);
|
return string_list_append(userdata->list, path, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue