diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-09-30 10:13:33 -0300 |
---|---|---|
committer | MisterMX <mbxd12@web.de> | 2022-10-14 21:51:38 +0200 |
commit | ea6cc3e2607a7b902a1a748e5b5623fcbb18da27 (patch) | |
tree | c637221a43f15b96434402b719c0e271d98716e4 /core | |
parent | f8745f2f71c79972df66f17a3da75f6e328bc55d (diff) |
Expose minizip API to allow creating zips using scripts
Co-authored-by: Marcelo Fernandez <marcelofg55@gmail.com>
Co-authored-by: James Westman <flyingpimonster@gmail.commail>
Co-authored-by: MisterMX <mbxd12@web.de>
Signed-off-by: MisterMX <mbxd12@web.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/io/zip_io.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp index e573e8de19..200e5f5e83 100644 --- a/core/io/zip_io.cpp +++ b/core/io/zip_io.cpp @@ -37,11 +37,17 @@ void *zipio_open(voidpf opaque, const char *p_fname, int mode) { String fname; fname.parse_utf8(p_fname); + int file_access_mode = 0; if (mode & ZLIB_FILEFUNC_MODE_WRITE) { - (*fa) = FileAccess::open(fname, FileAccess::WRITE); - } else { - (*fa) = FileAccess::open(fname, FileAccess::READ); + file_access_mode |= FileAccess::WRITE; } + if (mode & ZLIB_FILEFUNC_MODE_READ) { + file_access_mode |= FileAccess::READ; + } + if (mode & ZLIB_FILEFUNC_MODE_CREATE) { + file_access_mode |= FileAccess::WRITE_READ; + } + (*fa) = FileAccess::open(fname, file_access_mode); if (fa->is_null()) { return nullptr; |