| 1794 | } |
| 1795 | |
| 1796 | ResourceUID::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 | |
| 1817 | bool ResourceFormatLoaderCompatBinary::has_custom_uid_support() const { |
| 1818 | return true; |