diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-15 12:56:26 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-15 12:56:26 +0200 |
commit | 96ec73f3ee7c47286c3b9228f9ce26418a64952b (patch) | |
tree | 1fa85411f4d68466f06cfa2149d9c36cb13d5118 /core/io | |
parent | 2b7c7bd7e864367c1cfded2aaf0a789382361237 (diff) | |
parent | ea6cc3e2607a7b902a1a748e5b5623fcbb18da27 (diff) |
Merge pull request #65281 from MisterMX/zip-module
Expose minizip API to allow creating zips using scripts
Diffstat (limited to 'core/io')
-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; |