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

Method to_binary

compat/resource_loader_compat.cpp:514–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512}
513
514Error 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
527bool 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();

Callers

nothing calls this directly

Calls 2

custom_loadMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected