| 1765 | } |
| 1766 | |
| 1767 | void ResourceInteractiveLoaderXML::open(Ref<FileAccess> p_f) { |
| 1768 | error = OK; |
| 1769 | |
| 1770 | lines = 1; |
| 1771 | f = p_f; |
| 1772 | |
| 1773 | ResourceInteractiveLoaderXML::Tag *tag = parse_tag(); |
| 1774 | if (!tag || tag->name != "?xml" || !tag->args.has("version") || !tag->args.has("encoding") || tag->args["encoding"] != "UTF-8") { |
| 1775 | error = ERR_FILE_CORRUPT; |
| 1776 | ResourceLoader::notify_load_error("XML is invalid (missing header tags)"); |
| 1777 | ERR_FAIL_MSG("Not a XML:UTF-8 File: " + local_path); |
| 1778 | } |
| 1779 | |
| 1780 | tag_stack.clear(); |
| 1781 | |
| 1782 | tag = parse_tag(); |
| 1783 | |
| 1784 | if (!tag || tag->name != "resource_file" || !tag->args.has("type") || !tag->args.has("version")) { |
| 1785 | ResourceLoader::notify_load_error(local_path + ": XML is not a valid resource file."); |
| 1786 | error = ERR_FILE_CORRUPT; |
| 1787 | ERR_FAIL_MSG("Unrecognized XML File: " + local_path); |
| 1788 | } |
| 1789 | |
| 1790 | if (tag->args.has("subresource_count")) |
| 1791 | resources_total = tag->args["subresource_count"].to_int(); |
| 1792 | resource_current = 0; |
| 1793 | resource_type = tag->args["type"]; |
| 1794 | |
| 1795 | String version = tag->args["version"]; |
| 1796 | if (version.get_slice_count(".") != 2) { |
| 1797 | error = ERR_FILE_CORRUPT; |
| 1798 | ResourceLoader::notify_load_error(local_path + ":XML version string is invalid: " + version); |
| 1799 | ERR_FAIL_MSG("Invalid Version String '" + version + "'' in file: " + local_path); |
| 1800 | } |
| 1801 | |
| 1802 | int major = version.get_slicec('.', 0).to_int(); |
| 1803 | if (major > VERSION_MAJOR) { |
| 1804 | error = ERR_FILE_UNRECOGNIZED; |
| 1805 | ResourceLoader::notify_load_error(local_path + ": File Format '" + version + "' is too new. Please upgrade to a newer engine version."); |
| 1806 | ERR_FAIL_MSG("File Format '" + version + "' is too new! Please upgrade to a a new engine version: " + local_path); |
| 1807 | } |
| 1808 | |
| 1809 | /* |
| 1810 | String preload_depts = "deps/"+local_path.md5_text(); |
| 1811 | if (GDRESettings::get_singleton()->has(preload_depts)) { |
| 1812 | ext_resources.clear(); |
| 1813 | //ignore external resources and use these |
| 1814 | NodePath depts=GDRESettings::get_singleton()->get(preload_depts); |
| 1815 | |
| 1816 | for(int i=0;i<depts.get_name_count();i++) { |
| 1817 | ext_resources.push_back(depts.get_name(i)); |
| 1818 | } |
| 1819 | print_line(local_path+" - EXTERNAL RESOURCES: "+itos(ext_resources.size())); |
| 1820 | } |
| 1821 | */ |
| 1822 | } |
| 1823 | |
| 1824 | String ResourceInteractiveLoaderXML::recognize(Ref<FileAccess> p_f) { |
no test coverage detected