diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-21 00:07:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-21 00:07:31 +0200 |
| commit | 6b6e3bdce831417a3bec0e59571adf5efceda1f1 (patch) | |
| tree | 37fdaac31b9d17719d944c6a8099a34e6d1f8154 /platform/javascript | |
| parent | cc3ccf7caadbecd5c8a664e50abc01a6f09196e8 (diff) | |
| parent | 9c1fd917321a65ba1900b7d137dd5868887392b2 (diff) | |
Merge pull request #21233 from Essojadojef/custom-export-templates-fix
fix Android/HTML5 custom templates option does not work
Diffstat (limited to 'platform/javascript')
| -rw-r--r-- | platform/javascript/export/export.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 7cff6ba172..342e0e7802 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -140,14 +140,35 @@ Ref<Texture> EditorExportPlatformJavaScript::get_logo() const { bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { - r_missing_templates = false; + bool valid = false; + String err; + + if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) != "") + valid = true; + else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) != "") + valid = true; + + if (p_preset->get("custom_template/debug") != "") { + if (FileAccess::exists(p_preset->get("custom_template/debug"))) { + valid = true; + } else { + err += "Custom debug template not found.\n"; + } + } + + if (p_preset->get("custom_template/release") != "") { + if (FileAccess::exists(p_preset->get("custom_template/release"))) { + valid = true; + } else { + err += "Custom release template not found.\n"; + } + } - if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) == String()) - r_missing_templates = true; - else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) == String()) - r_missing_templates = true; + if (!err.empty()) + r_error = err; - return !r_missing_templates; + r_missing_templates = !valid; + return valid; } String EditorExportPlatformJavaScript::get_binary_extension(const Ref<EditorExportPreset> &p_preset) const { |