| 93 | // void _set_resource_info(Ref<ResourceInfo> &info, const String &p_path) const; |
| 94 | |
| 95 | Error ResourceFormatGDScriptLoader::_set_resource_info(Ref<ResourceInfo> &info, const String &p_path) { |
| 96 | info->type = _get_resource_type(p_path); |
| 97 | if (info->type == "") { |
| 98 | return ERR_FILE_UNRECOGNIZED; |
| 99 | } |
| 100 | String extension = p_path.get_extension().to_lower(); |
| 101 | auto rev = GDRESettings::get_singleton()->get_bytecode_revision(); |
| 102 | if (rev) { |
| 103 | auto decomp = GDScriptDecomp::create_decomp_for_commit(rev); |
| 104 | if (decomp.is_valid()) { |
| 105 | Ref<GodotVer> ver = decomp->get_godot_ver(); |
| 106 | if (ver.is_valid() && ver->is_valid_semver()) { |
| 107 | info->ver_major = ver->get_major(); |
| 108 | info->ver_minor = ver->get_minor(); |
| 109 | } |
| 110 | info->ver_format = decomp->get_bytecode_version(); |
| 111 | } |
| 112 | } |
| 113 | if (extension == "gd") { |
| 114 | info->resource_format = "GDScriptText"; |
| 115 | } else if (extension == "gdc" || extension == "gde") { |
| 116 | info->resource_format = "GDScriptBytecode"; |
| 117 | } else if (extension == "cs") { |
| 118 | info->resource_format = "CSharpScriptText"; |
| 119 | } else { |
| 120 | info->resource_format = "GDScriptText"; |
| 121 | } |
| 122 | return OK; |
| 123 | } |
| 124 | |
| 125 | // for embedded scripts |
| 126 | Ref<Resource> FakeScriptConverterCompat::convert(const Ref<MissingResource> &res, ResourceInfo::LoadType p_type, int ver_major, Error *r_error) { |
nothing calls this directly
no test coverage detected