Skip to content

Commit

Permalink
Merge pull request #46458 from m4gr3d/fix_invalid_missing_templates_e…
Browse files Browse the repository at this point in the history
…rror

[3.2] Fix invalid missing template error when the Android build template is not installed
  • Loading branch information
akien-mga authored Feb 27, 2021
2 parents 3720dc2 + 92d3287 commit 8385a0d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,14 +2051,15 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String template_err;
bool dvalid = false;
bool rvalid = false;
bool has_export_templates = false;

if (p_preset->get("custom_template/debug") != "") {
dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
if (!dvalid) {
template_err += TTR("Custom debug template not found.") + "\n";
}
} else {
dvalid = exists_export_template("android_debug.apk", &template_err);
has_export_templates |= exists_export_template("android_debug.apk", &template_err);
}

if (p_preset->get("custom_template/release") != "") {
Expand All @@ -2067,23 +2068,25 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
template_err += TTR("Custom release template not found.") + "\n";
}
} else {
rvalid = exists_export_template("android_release.apk", &template_err);
has_export_templates |= exists_export_template("android_release.apk", &template_err);
}

valid = dvalid || rvalid;
r_missing_templates = !has_export_templates;
valid = dvalid || rvalid || has_export_templates;
if (!valid) {
err += template_err;
}
} else {
valid = exists_export_template("android_source.zip", &err);
r_missing_templates = !exists_export_template("android_source.zip", &err);

if (!FileAccess::exists("res://android/build/build.gradle")) {
bool installed_android_build_template = FileAccess::exists("res://android/build/build.gradle");
if (!installed_android_build_template) {

err += TTR("Android build template not installed in the project. Install it from the Project menu.") + "\n";
valid = false;
}

valid = installed_android_build_template && !r_missing_templates;
}
r_missing_templates = !valid;

// Validate the rest of the configuration.

Expand Down

0 comments on commit 8385a0d

Please sign in to comment.