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

Method get_resource_uid

compat/resource_compat_binary.cpp:1796–1815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1794}
1795
1796ResourceUID::ID ResourceFormatLoaderCompatBinary::get_resource_uid(const String &p_path) const {
1797 String ext = p_path.get_extension().to_lower();
1798 if (!ClassDB::is_resource_extension(ext)) {
1799 return ResourceUID::INVALID_ID;
1800 }
1801
1802 Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
1803 if (f.is_null()) {
1804 return ResourceUID::INVALID_ID; //could not read
1805 }
1806
1807 ResourceLoaderCompatBinary loader;
1808 loader.local_path = p_path; // No need for local path, it only gets used in error meesges.
1809 loader.res_path = loader.local_path;
1810 loader.open(f, true, true);
1811 if (loader.error != OK) {
1812 return ResourceUID::INVALID_ID; //could not read
1813 }
1814 return loader.uid;
1815}
1816
1817bool ResourceFormatLoaderCompatBinary::has_custom_uid_support() const {
1818 return true;

Callers

nothing calls this directly

Calls 1

openMethod · 0.45

Tested by

no test coverage detected