mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
treat .apk files as .zip, set archive_path any time we need to decompress a file
This commit is contained in:
parent
db2d66f00a
commit
137968c001
@ -560,6 +560,7 @@ struct string_list *file_archive_get_file_list(const char *path,
|
||||
{
|
||||
struct archive_extract_userdata userdata = {0};
|
||||
userdata.list_only = true;
|
||||
userdata.archive_path = strdup(path);
|
||||
|
||||
userdata.list = string_list_new();
|
||||
|
||||
@ -570,9 +571,20 @@ struct string_list *file_archive_get_file_list(const char *path,
|
||||
file_archive_get_file_list_cb, &userdata))
|
||||
goto error;
|
||||
|
||||
if (userdata.archive_path)
|
||||
{
|
||||
free(userdata.archive_path);
|
||||
userdata.archive_path = NULL;
|
||||
}
|
||||
|
||||
return userdata.list;
|
||||
|
||||
error:
|
||||
if (userdata.archive_path)
|
||||
{
|
||||
free(userdata.archive_path);
|
||||
userdata.archive_path = NULL;
|
||||
}
|
||||
if (userdata.list)
|
||||
string_list_free(userdata.list);
|
||||
return NULL;
|
||||
@ -769,7 +781,8 @@ const struct file_archive_file_backend* file_archive_get_file_backend(const char
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if (string_is_equal_noncase(file_ext, "zip"))
|
||||
if (string_is_equal_noncase(file_ext, "zip") ||
|
||||
string_is_equal_noncase(file_ext, "apk"))
|
||||
return &zlib_backend;
|
||||
#endif
|
||||
|
||||
|
@ -104,8 +104,13 @@ const char *path_get_archive_delim(const char *path)
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if (last)
|
||||
{
|
||||
delim = strcasestr(last, ".zip#");
|
||||
|
||||
if (!delim)
|
||||
delim = strcasestr(last, ".apk#");
|
||||
}
|
||||
|
||||
if (delim)
|
||||
return delim + 4;
|
||||
#endif
|
||||
@ -194,7 +199,8 @@ bool path_is_compressed_file(const char* path)
|
||||
const char *ext = path_get_extension(path);
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if (string_is_equal_noncase(ext, "zip"))
|
||||
if (string_is_equal_noncase(ext, "zip") ||
|
||||
string_is_equal_noncase(ext, "apk"))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
@ -482,7 +488,7 @@ void path_basedir(char *path)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* We want to find the directory with the zipfile in basedir. */
|
||||
/* We want to find the directory with the archive in basedir. */
|
||||
last = (char*)path_get_archive_delim(path);
|
||||
if (last)
|
||||
*last = '\0';
|
||||
|
@ -156,18 +156,18 @@ int file_archive_parse_file_progress(file_archive_transfer_t *state);
|
||||
|
||||
/**
|
||||
* file_archive_extract_file:
|
||||
* @zip_path : filename path to ZIP archive.
|
||||
* @zip_path_size : size of ZIP archive.
|
||||
* @archive_path : filename path to ZIP archive.
|
||||
* @archive_path_size : size of ZIP archive.
|
||||
* @valid_exts : valid extensions for a file.
|
||||
* @extraction_directory : the directory to extract temporary
|
||||
* unzipped file to.
|
||||
* @extraction_directory : the directory to extract the temporary
|
||||
* file to.
|
||||
*
|
||||
* Extract file from archive. If no file inside the archive is
|
||||
* specified, the first file found will be used.
|
||||
*
|
||||
* Returns : true (1) on success, otherwise false (0).
|
||||
**/
|
||||
bool file_archive_extract_file(char *zip_path, size_t zip_path_size,
|
||||
bool file_archive_extract_file(char *archive_path, size_t archive_path_size,
|
||||
const char *valid_exts, const char *extraction_dir,
|
||||
char *out_path, size_t len);
|
||||
|
||||
|
@ -345,7 +345,7 @@ static int database_info_list_iterate_next(
|
||||
static int task_database_iterate_crc_lookup(
|
||||
database_state_handle_t *db_state,
|
||||
database_info_handle_t *db,
|
||||
const char *zip_entry)
|
||||
const char *archive_entry)
|
||||
{
|
||||
|
||||
if (!db_state->list ||
|
||||
@ -378,7 +378,7 @@ static int task_database_iterate_crc_lookup(
|
||||
db_state, db, NULL);
|
||||
if (db_state->crc == db_info_entry->crc32)
|
||||
return database_info_list_iterate_found_match(
|
||||
db_state, db, zip_entry);
|
||||
db_state, db, archive_entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user