diff options
Diffstat (limited to 'editor/doc_tools.cpp')
-rw-r--r-- | editor/doc_tools.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 749ab7e2f6..a9d18e9dcc 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -1356,7 +1356,12 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str header += " inherits=\"" + c.inherits + "\""; } header += String(" version=\"") + VERSION_BRANCH + "\""; - header += ">"; + // Reference the XML schema so editors can provide error checking. + // Modules are nested deep, so change the path to reference the same schema everywhere. + const String schema_path = save_path.find("modules/") != -1 ? "../../../doc/class.xsd" : "../class.xsd"; + header += vformat( + R"( xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="%s">)", + schema_path); _write_string(f, 0, header); _write_string(f, 1, "<brief_description>"); @@ -1370,7 +1375,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str _write_string(f, 1, "<tutorials>"); for (int i = 0; i < c.tutorials.size(); i++) { DocData::TutorialDoc tutorial = c.tutorials.get(i); - String title_attribute = (!tutorial.title.is_empty()) ? " title=\"" + tutorial.title.xml_escape() + "\"" : ""; + String title_attribute = (!tutorial.title.is_empty()) ? " title=\"" + _translate_doc_string(tutorial.title).xml_escape() + "\"" : ""; _write_string(f, 2, "<link" + title_attribute + ">" + tutorial.link.xml_escape() + "</link>"); } _write_string(f, 1, "</tutorials>"); @@ -1463,7 +1468,8 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str Error DocTools::load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size) { Vector<uint8_t> data; data.resize(p_uncompressed_size); - Compression::decompress(data.ptrw(), p_uncompressed_size, p_data, p_compressed_size, Compression::MODE_DEFLATE); + int ret = Compression::decompress(data.ptrw(), p_uncompressed_size, p_data, p_compressed_size, Compression::MODE_DEFLATE); + ERR_FAIL_COND_V_MSG(ret == -1, ERR_FILE_CORRUPT, "Compressed file is corrupt."); class_list.clear(); Ref<XMLParser> parser = memnew(XMLParser); |