| 397 | } |
| 398 | |
| 399 | Ref<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 | |
| 414 | bool GDREPackedData::has_path(const String &p_path) { |
| 415 | return files.has(PathMD5(p_path.simplify_path().trim_prefix("res://").md5_buffer())); |
no test coverage detected