MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / get_file_handle

Method get_file_handle

utility/file_access_apk.cpp:122–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122unzFile APKArchive::get_file_handle(String p_file) const {
123 ERR_FAIL_COND_V_MSG(!file_exists(p_file), nullptr, "File '" + p_file + " doesn't exist.");
124 File file = files[p_file];
125
126 zlib_filefunc64_def io;
127 memset(&io, 0, sizeof(io));
128
129 io.opaque = nullptr;
130 io.zopen64_file = godot_open;
131 io.zread_file = godot_read;
132 io.zwrite_file = godot_write;
133
134 io.ztell64_file = godot_tell;
135 io.zseek64_file = godot_seek;
136 io.zclose_file = godot_close;
137 io.zerror_file = godot_testerror;
138
139 io.alloc_mem = godot_alloc;
140 io.free_mem = godot_free;
141
142 unzFile pkg = unzOpen2_64(packages[file.package].filename.utf8().get_data(), &io);
143 ERR_FAIL_COND_V_MSG(!pkg, nullptr, "Cannot open file '" + packages[file.package].filename + "'.");
144 int unz_err = unzGoToFilePos(pkg, &file.file_pos);
145 if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) {
146 unzClose(pkg);
147 ERR_FAIL_V(nullptr);
148 }
149
150 return pkg;
151}
152
153Error APKArchive::get_version_string_from_manifest(String &version_string) {
154 AXMLParser parser;

Callers 1

open_internalMethod · 0.80

Calls 1

get_dataMethod · 0.45

Tested by

no test coverage detected