From 9c1fd917321a65ba1900b7d137dd5868887392b2 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Mon, 20 Aug 2018 17:35:33 +0200 Subject: [PATCH] fix Android/HTML5 custom templates option does not work --- platform/android/export/export.cpp | 18 ++++++++++++++- platform/javascript/export/export.cpp | 33 ++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index fb19c5d33f5..4537f6f326e 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1333,12 +1333,28 @@ public: virtual bool can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates) const { + String err; r_missing_templates = find_export_template("android_debug.apk") == String() || find_export_template("android_release.apk") == String(); + if (p_preset->get("custom_package/debug") != "") { + if (FileAccess::exists(p_preset->get("custom_package/debug"))) { + r_missing_templates = false; + } else { + err += "Custom debug package not found.\n"; + } + } + + if (p_preset->get("custom_package/release") != "") { + if (FileAccess::exists(p_preset->get("custom_package/release"))) { + r_missing_templates = false; + } else { + err += "Custom release package not found.\n"; + } + } + bool valid = !r_missing_templates; String adb = EditorSettings::get_singleton()->get("export/android/adb"); - String err; if (!FileAccess::exists(adb)) { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 7cff6ba172d..342e0e7802c 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -140,14 +140,35 @@ Ref EditorExportPlatformJavaScript::get_logo() const { bool EditorExportPlatformJavaScript::can_export(const Ref &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) == String()) - r_missing_templates = true; - else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) == String()) - r_missing_templates = true; + if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) != "") + valid = true; + else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) != "") + valid = true; - return !r_missing_templates; + 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 (!err.empty()) + r_error = err; + + r_missing_templates = !valid; + return valid; } String EditorExportPlatformJavaScript::get_binary_extension(const Ref &p_preset) const {