mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
Added zipfile support to all compressed file factories - i.e. file_list, path_is_compressed and read_compressed_file
This commit is contained in:
parent
2dfc763ca9
commit
674a8b5f33
27
file_path.c
27
file_path.c
@ -63,6 +63,9 @@
|
||||
#ifdef HAVE_7ZIP
|
||||
#include "decompress/7zip_support.h"
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
#include "decompress/zip_support.h"
|
||||
#endif
|
||||
|
||||
/* Dump to file. */
|
||||
bool write_file(const char *path, const void *data, size_t size)
|
||||
@ -81,8 +84,18 @@ bool write_file(const char *path, const void *data, size_t size)
|
||||
#ifdef HAVE_COMPRESSION
|
||||
long read_compressed_file(const char * archive_path, const char *relative_path, void **buf)
|
||||
{
|
||||
const char* file_ext = path_get_extension(archive_path);
|
||||
#ifdef HAVE_7ZIP
|
||||
return read_7zip_file(archive_path,relative_path,buf);
|
||||
if (strcmp(file_ext,"7z") == 0)
|
||||
{
|
||||
return read_7zip_file(archive_path,relative_path,buf);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (strcmp(file_ext,"zip") == 0)
|
||||
{
|
||||
return read_zip_file(archive_path,relative_path,buf);
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@ -387,6 +400,12 @@ struct string_list *compressed_file_list_new(const char *path,
|
||||
return compressed_7zip_file_list_new(path,ext);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (strcmp(file_ext,"zip") == 0)
|
||||
{
|
||||
return compressed_zip_file_list_new(path,ext);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return NULL;
|
||||
@ -613,6 +632,12 @@ bool path_is_compressed_file(const char* path)
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
if (strcmp(file_ext,"zip") == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user