diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-09-03 07:33:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 07:33:19 +0200 |
commit | 4a5138bb99f5a063035c1d34de26af050bef5dc3 (patch) | |
tree | 6ed4d6eecf7ed43ff107873619260788ebcc5e50 /core/io/file_access_zip.cpp | |
parent | 71833520da2bfa39201bc9734432de47a18aaa14 (diff) | |
parent | c524d50444f98039faab75f7d701ca54a82e5848 (diff) | |
download | redot-engine-4a5138bb99f5a063035c1d34de26af050bef5dc3.tar.gz |
Merge pull request #40400 from Arivval/load-resourcepack-with-offset
Added PCK file loading with offset feature
Diffstat (limited to 'core/io/file_access_zip.cpp')
-rw-r--r-- | core/io/file_access_zip.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index c3a62706c7..974bb65a18 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -147,8 +147,11 @@ unzFile ZipArchive::get_file_handle(String p_file) const { return pkg; } -bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files) { +bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, size_t p_offset = 0) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); + // load with offset feature only supported for PCK files + ERR_FAIL_COND_V_MSG(p_offset != 0, false, "Invalid PCK data. Note that loading files with a non-zero offset isn't supported with ZIP archives."); + if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0) { return false; } |