| 512 | } |
| 513 | |
| 514 | Error ResourceCompatLoader::to_binary(const String &p_path, const String &p_dst, uint32_t p_flags) { |
| 515 | auto loader = get_loader_for_path(p_path, ""); |
| 516 | ERR_FAIL_COND_V_MSG(loader.is_null(), ERR_FILE_NOT_FOUND, "Failed to load resource '" + p_path + "'. ResourceFormatLoader::load was not implemented for this resource type."); |
| 517 | Error err; |
| 518 | |
| 519 | auto res = loader->custom_load(p_path, {}, ResourceInfo::LoadType::FAKE_LOAD, &err); |
| 520 | ERR_FAIL_COND_V_MSG(err != OK || res.is_null(), err, "Failed to load " + p_path); |
| 521 | err = gdre::ensure_dir(p_dst.get_base_dir()); |
| 522 | ERR_FAIL_COND_V_MSG(err != OK, err, "Failed to create directory for " + p_dst); |
| 523 | ResourceFormatSaverCompatBinaryInstance saver; |
| 524 | return saver.save(p_dst, res, p_flags); |
| 525 | } |
| 526 | |
| 527 | bool ResourceCompatLoader::handles_resource(const String &p_path, const String &p_type_hint) { |
| 528 | return !get_loader_for_path(p_path, p_type_hint).is_null(); |
nothing calls this directly
no test coverage detected