diff options
| author | Rémi Verschelde | 2018-02-25 15:24:33 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2018-02-25 15:29:28 +0100 |
| commit | be771e71652f14b5bb3fd1c6c62a39a4ccd85417 (patch) | |
| tree | 40f89683d1a14f1ea8ddaf7175cb728c5cfe11bc /editor/export_template_manager.cpp | |
| parent | cb656178978df64ccf53cb06fa0d00c61040138a (diff) | |
| download | godot-be771e71652f14b5bb3fd1c6c62a39a4ccd85417.tar.gz godot-be771e71652f14b5bb3fd1c6c62a39a4ccd85417.tar.zst godot-be771e71652f14b5bb3fd1c6c62a39a4ccd85417.zip | |
Fix version.txt validation logic for export templates .tpz
It assumed that the version would always be `x.y-status`,
with no dot possible in `status`, so:
- It would not work for 3.0.1-stable (nor 3.0.1.stable with new version logic)
- It would not support Mono templates when we provide them
The validation it did was not really useful anyway, so we just use the raw
string.
(cherry picked from commit eec9261a75699723f6e4b722910e5bb762b736db)
Diffstat (limited to 'editor/export_template_manager.cpp')
| -rw-r--r-- | editor/export_template_manager.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index aeb1e6944..8115485b6 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -215,25 +215,15 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ data_str.parse_utf8((const char *)data.ptr(), data.size()); data_str = data_str.strip_edges(); - if (data_str.get_slice_count("-") != 2 || data_str.get_slice_count(".") != 2) { + // Version number should be of the form major.minor[.patch].status[.module_config] + // so it can in theory have 3 or more slices. + if (data_str.get_slice_count(".") < 3) { EditorNode::get_singleton()->show_warning(TTR("Invalid version.txt format inside templates.")); unzClose(pkg); return; } - String ver = data_str.get_slice("-", 0); - - int major = ver.get_slice(".", 0).to_int(); - int minor = ver.get_slice(".", 1).to_int(); - String rev = data_str.get_slice("-", 1); - - if (!rev.is_valid_identifier()) { - EditorNode::get_singleton()->show_warning(TTR("Invalid version.txt format inside templates. Revision is not a valid identifier.")); - unzClose(pkg); - return; - } - - version = itos(major) + "." + itos(minor) + "-" + rev; + version = data_str; } fc++; |
