Merge pull request #21233 from Essojadojef/custom-export-templates-fix

fix Android/HTML5 custom templates option does not work
This commit is contained in:
Rémi Verschelde 2018-08-21 00:07:31 +02:00 committed by GitHub
commit 6b6e3bdce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 7 deletions

View file

@ -1333,12 +1333,28 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { virtual bool can_export(const Ref<EditorExportPreset> &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(); 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; bool valid = !r_missing_templates;
String adb = EditorSettings::get_singleton()->get("export/android/adb"); String adb = EditorSettings::get_singleton()->get("export/android/adb");
String err;
if (!FileAccess::exists(adb)) { if (!FileAccess::exists(adb)) {

View file

@ -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 { 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) == String()) if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) != "")
r_missing_templates = true; valid = true;
else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) == String()) else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) != "")
r_missing_templates = true; 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<EditorExportPreset> &p_preset) const { String EditorExportPlatformJavaScript::get_binary_extension(const Ref<EditorExportPreset> &p_preset) const {