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

Method open_internal

utility/file_access_gdre.cpp:483–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483Error FileAccessGDRE::open_internal(const String &p_path, int p_mode_flags) {
484 path = p_path;
485 mode_flags = p_mode_flags;
486 //try packed data first
487 if (should_check_pack(p_mode_flags) && GDREPackedData::get_singleton() && !GDREPackedData::get_singleton()->is_disabled()) {
488 proxy = GDREPackedData::get_singleton()->try_open_path(p_path);
489 if (proxy.is_valid()) {
490 if (is_gdre_file(p_path)) {
491 WARN_PRINT(vformat("Opening gdre file %s from a loaded external pack???? PLEASE REPORT THIS!!!!", p_path));
492 };
493 return proxy->get_error();
494 }
495 }
496 if (should_check_pack(p_mode_flags) && is_gdre_file(p_path)) {
497 WARN_PRINT(vformat("Attempted to open a gdre file %s while we have a pack loaded...", p_path));
498 if (PathFinder::real_packed_data_has_path(p_path)) {
499 // this works even when PackedData is disabled
500 proxy = PackedData::get_singleton()->try_open_path(p_path);
501 if (proxy.is_valid()) {
502 return proxy->get_error();
503 }
504 }
505 }
506 // Otherwise, it's on the file system.
507 String fixed_path = PathFinder::_fix_path_file_access(p_path, p_mode_flags);
508 Error err;
509 proxy = _open_filesystem(fixed_path, p_mode_flags, &err);
510 if (err != OK) {
511 proxy = Ref<FileAccess>();
512 }
513 return err;
514}
515
516bool FileAccessGDRE::is_open() const {
517 if (proxy.is_null()) {

Callers 1

_open_filesystemMethod · 0.45

Calls 6

should_check_packFunction · 0.85
is_gdre_fileFunction · 0.85
is_disabledMethod · 0.80
try_open_pathMethod · 0.80
is_validMethod · 0.45
get_errorMethod · 0.45

Tested by

no test coverage detected