(Statically linked RA) Make 'Open Archive' work when there are
no core info files
This commit is contained in:
parent
b541cd95ef
commit
1ddd0ab1d3
|
@ -178,9 +178,9 @@ static int file_archive_get_file_list_cb(
|
||||||
struct archive_extract_userdata *userdata)
|
struct archive_extract_userdata *userdata)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
|
int ret = 0;
|
||||||
struct string_list *ext_list = NULL;
|
struct string_list *ext_list = NULL;
|
||||||
const char *file_ext = NULL;
|
size_t path_len = strlen(path);
|
||||||
size_t pathLen = strlen(path);
|
|
||||||
|
|
||||||
(void)cdata;
|
(void)cdata;
|
||||||
(void)cmode;
|
(void)cmode;
|
||||||
|
@ -190,7 +190,7 @@ static int file_archive_get_file_list_cb(
|
||||||
|
|
||||||
memset(&attr, 0, sizeof(attr));
|
memset(&attr, 0, sizeof(attr));
|
||||||
|
|
||||||
if (!pathLen)
|
if (!path_len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (valid_exts)
|
if (valid_exts)
|
||||||
|
@ -198,8 +198,9 @@ static int file_archive_get_file_list_cb(
|
||||||
|
|
||||||
if (ext_list)
|
if (ext_list)
|
||||||
{
|
{
|
||||||
|
const char *file_ext = NULL;
|
||||||
/* Checks if this entry is a directory or a file. */
|
/* Checks if this entry is a directory or a file. */
|
||||||
char last_char = path[pathLen-1];
|
char last_char = path[path_len-1];
|
||||||
|
|
||||||
/* Skip if directory. */
|
/* Skip if directory. */
|
||||||
if (last_char == '/' || last_char == '\\' )
|
if (last_char == '/' || last_char == '\\' )
|
||||||
|
@ -207,9 +208,14 @@ static int file_archive_get_file_list_cb(
|
||||||
|
|
||||||
file_ext = path_get_extension(path);
|
file_ext = path_get_extension(path);
|
||||||
|
|
||||||
if (!file_ext ||
|
if (!file_ext)
|
||||||
!string_list_find_elem_prefix(ext_list, ".", file_ext))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (!string_list_find_elem_prefix(ext_list, ".", file_ext))
|
||||||
|
{
|
||||||
|
ret = -1;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;
|
||||||
string_list_free(ext_list);
|
string_list_free(ext_list);
|
||||||
|
@ -219,7 +225,7 @@ static int file_archive_get_file_list_cb(
|
||||||
|
|
||||||
error:
|
error:
|
||||||
string_list_free(ext_list);
|
string_list_free(ext_list);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file_archive_extract_cb(const char *name, const char *valid_exts,
|
static int file_archive_extract_cb(const char *name, const char *valid_exts,
|
||||||
|
@ -573,6 +579,7 @@ end:
|
||||||
struct string_list *file_archive_get_file_list(const char *path,
|
struct string_list *file_archive_get_file_list(const char *path,
|
||||||
const char *valid_exts)
|
const char *valid_exts)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct archive_extract_userdata userdata = {{0}};
|
struct archive_extract_userdata userdata = {{0}};
|
||||||
|
|
||||||
userdata.list_only = true;
|
userdata.list_only = true;
|
||||||
|
@ -583,9 +590,12 @@ struct string_list *file_archive_get_file_list(const char *path,
|
||||||
if (!userdata.list)
|
if (!userdata.list)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!file_archive_walk(path, valid_exts,
|
if ((ret = file_archive_walk(path, valid_exts,
|
||||||
file_archive_get_file_list_cb, &userdata))
|
file_archive_get_file_list_cb, &userdata)) <= 0)
|
||||||
goto error;
|
{
|
||||||
|
if (ret != -1)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
return userdata.list;
|
return userdata.list;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue