mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 10:20:57 +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
|
#ifdef HAVE_7ZIP
|
||||||
#include "decompress/7zip_support.h"
|
#include "decompress/7zip_support.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
#include "decompress/zip_support.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump to file. */
|
/* Dump to file. */
|
||||||
bool write_file(const char *path, const void *data, size_t size)
|
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
|
#ifdef HAVE_COMPRESSION
|
||||||
long read_compressed_file(const char * archive_path, const char *relative_path, void **buf)
|
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
|
#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
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -387,6 +400,12 @@ struct string_list *compressed_file_list_new(const char *path,
|
|||||||
return compressed_7zip_file_list_new(path,ext);
|
return compressed_7zip_file_list_new(path,ext);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
if (strcmp(file_ext,"zip") == 0)
|
||||||
|
{
|
||||||
|
return compressed_zip_file_list_new(path,ext);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -613,6 +632,12 @@ bool path_is_compressed_file(const char* path)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
|
if (strcmp(file_ext,"zip") == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user