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

Method try_open_path

utility/file_access_gdre.cpp:399–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399Ref<FileAccess> GDREPackedData::try_open_path(const String &p_path) {
400 String simplified_path = p_path.simplify_path().trim_prefix("res://");
401 PathMD5 pmd5(simplified_path.md5_buffer());
402 HashMap<PathMD5, PackedData::PackedFile, PathMD5>::Iterator E = files.find(pmd5);
403 if (!E) {
404 return nullptr; //not found
405 }
406
407 if (E->value.offset == 0 && !E->value.bundle) {
408 return nullptr; //was erased
409 }
410
411 return E->value.src->get_file(p_path, &E->value);
412}
413
414bool GDREPackedData::has_path(const String &p_path) {
415 return files.has(PathMD5(p_path.simplify_path().trim_prefix("res://").md5_buffer()));

Callers 1

open_internalMethod · 0.80

Calls 2

findMethod · 0.45
get_fileMethod · 0.45

Tested by

no test coverage detected