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

Method try_open_pack

utility/file_access_gdre.cpp:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include "utility/file_access_buffer.h"
14
15bool DirSource::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset, const Vector<uint8_t> &p_decryption_key) {
16 if (!DirAccess::exists(p_path)) {
17 return false;
18 }
19 Ref<DirAccess> da = DirAccess::open(p_path);
20 if (da.is_null()) {
21 return false;
22 }
23 PackedStringArray pa = gdre::get_recursive_dir_list(p_path, {}, false);
24 if (is_print_verbose_enabled()) {
25 for (auto s : pa) {
26 print_verbose(s);
27 }
28 }
29 Ref<GDRESettings::PackInfo> pckinfo;
30 pckinfo.instantiate();
31 pckinfo->init(p_path, Ref<GodotVer>(memnew(GodotVer)), 1, 0, 0, pa.size(), GDRESettings::PackInfo::DIR);
32 GDRESettings::get_singleton()->add_pack_info(pckinfo);
33 for (auto &path : pa) {
34 size_t size = 0;
35 Ref<FileAccess> fa = FileAccess::open(p_path.path_join(path), FileAccess::READ);
36 if (fa.is_valid()) {
37 size = fa->get_length();
38 }
39 GDREPackedData::get_singleton()->add_path(p_path, path, 1, size, MD5_EMPTY, this, p_replace_files, false, false);
40 }
41 packs.push_back(p_path);
42 return true;
43}
44
45Ref<FileAccess> DirSource::get_file(const String &p_path, PackedData::PackedFile *p_file, const Vector<uint8_t> &p_decryption_key) {
46 if (!p_file) {

Callers 2

add_packMethod · 0.45
add_dirMethod · 0.45

Calls 7

add_pack_infoMethod · 0.80
push_backMethod · 0.80
initMethod · 0.45
sizeMethod · 0.45
is_validMethod · 0.45
get_lengthMethod · 0.45
add_pathMethod · 0.45

Tested by

no test coverage detected