summaryrefslogtreecommitdiffstats
path: root/core/io/file_access_zip.cpp
diff options
context:
space:
mode:
authorYilin Ma <yilinma3@illinois.edu>2020-07-13 11:22:06 -0500
committerYilin Ma <yilinma3@illinois.edu>2020-09-02 17:57:01 -0500
commitc524d50444f98039faab75f7d701ca54a82e5848 (patch)
tree4fb8b3a8b707ce434f4ca199b7e119ad275f7577 /core/io/file_access_zip.cpp
parentb55d859c5f092d145cd0d2c8df9ac5d42c500626 (diff)
downloadredot-engine-c524d50444f98039faab75f7d701ca54a82e5848.tar.gz
added load resource pack with offset feature
updated variables to use size_t removed line break to make code style more consistent added conditional check to return an error if offset field is used when loading a ZIP package fixed typo formatted file added commit regarding self contained exe files handled error loging for load zip file with offset spelling tweak updated conditional statement for magic check udpated error message when load Zip file with offset is called fix CI Trying to fix CI fix CI done Added error message for loading self-contained exe with offset. Updated documentation. Fix indent final fix indent Updated documentation. fix indents Updated doc based on suggestion Final fix fixed format
Diffstat (limited to 'core/io/file_access_zip.cpp')
-rw-r--r--core/io/file_access_zip.cpp5
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;
}