| 481 | } |
| 482 | |
| 483 | Error 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 | |
| 516 | bool FileAccessGDRE::is_open() const { |
| 517 | if (proxy.is_null()) { |
no test coverage detected