MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_files

Method get_files

modules/zip/zip_reader.cpp:66–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66PackedStringArray ZIPReader::get_files() {
67 ERR_FAIL_COND_V_MSG(fa.is_null(), PackedStringArray(), "ZIPReader must be opened before use.");
68
69 unz_global_info gi;
70 int err = unzGetGlobalInfo(uzf, &gi);
71 ERR_FAIL_COND_V(err != UNZ_OK, PackedStringArray());
72 if (gi.number_entry == 0) {
73 return PackedStringArray();
74 }
75
76 err = unzGoToFirstFile(uzf);
77 ERR_FAIL_COND_V(err != UNZ_OK, PackedStringArray());
78
79 List<String> s;
80 do {
81 unz_file_info64 file_info;
82 String filepath;
83
84 err = godot_unzip_get_current_file_info(uzf, file_info, filepath);
85 if (err == UNZ_OK) {
86 s.push_back(filepath);
87 }
88 } while (unzGoToNextFile(uzf) == UNZ_OK);
89
90 PackedStringArray arr;
91 arr.resize(s.size());
92 int idx = 0;
93 for (const List<String>::Element *E = s.front(); E; E = E->next()) {
94 arr.set(idx++, E->get());
95 }
96 return arr;
97}
98
99PackedByteArray ZIPReader::read_file(const String &p_path, bool p_case_sensitive) {
100 ERR_FAIL_COND_V_MSG(fa.is_null(), PackedByteArray(), "ZIPReader must be opened before use.");

Callers 1

test_zip.hFile · 0.45

Calls 9

sizeMethod · 0.65
is_nullMethod · 0.45
push_backMethod · 0.45
resizeMethod · 0.45
frontMethod · 0.45
nextMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected