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

Method remove_path

utility/file_access_gdre.cpp:328–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void GDREPackedData::remove_path(const String &p_path) {
329 String simplified_path = p_path.simplify_path().trim_prefix("res://");
330
331 PathMD5 pmd5(simplified_path.md5_buffer());
332 if (!files.has(pmd5)) {
333 return;
334 }
335
336 // Search for directory.
337 PackedDir *cd = root;
338
339 if (simplified_path.contains_char('/')) { // In a subdirectory.
340 Vector<String> ds = simplified_path.get_base_dir().split("/");
341
342 for (int j = 0; j < ds.size(); j++) {
343 if (!cd->subdirs.has(ds[j])) {
344 return; // Subdirectory does not exist, do not bother creating.
345 } else {
346 cd = cd->subdirs[ds[j]];
347 }
348 }
349 }
350
351 if (file_map.has(p_path.simplify_path())) {
352 file_map.erase(p_path.simplify_path());
353 }
354
355 cd->files.erase(simplified_path.get_file());
356
357 files.erase(pmd5);
358}
359
360void GDREPackedData::set_disabled(bool p_disabled) {
361 if (p_disabled) {

Callers 1

try_open_packMethod · 0.80

Calls 4

splitMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45
get_fileMethod · 0.45

Tested by

no test coverage detected