Fix inconsistent error messages with Android custom export templates

(cherry picked from commit be22a1f9bc)
This commit is contained in:
PouleyKetchoupp 2020-06-01 23:13:31 +02:00 committed by Rémi Verschelde
parent f911ebc328
commit aa935c262a
1 changed files with 13 additions and 4 deletions

View File

@ -1788,23 +1788,32 @@ public:
// Look for export templates (first official, and if defined custom templates). // Look for export templates (first official, and if defined custom templates).
if (!bool(p_preset->get("custom_template/use_custom_build"))) { if (!bool(p_preset->get("custom_template/use_custom_build"))) {
bool dvalid = exists_export_template("android_debug.apk", &err); String template_err;
bool rvalid = exists_export_template("android_release.apk", &err); bool dvalid = false;
bool rvalid = false;
if (p_preset->get("custom_template/debug") != "") { if (p_preset->get("custom_template/debug") != "") {
dvalid = FileAccess::exists(p_preset->get("custom_template/debug")); dvalid = FileAccess::exists(p_preset->get("custom_template/debug"));
if (!dvalid) { if (!dvalid) {
err += TTR("Custom debug template not found.") + "\n"; template_err += TTR("Custom debug template not found.") + "\n";
} }
} else {
dvalid = exists_export_template("android_debug.apk", &template_err);
} }
if (p_preset->get("custom_template/release") != "") { if (p_preset->get("custom_template/release") != "") {
rvalid = FileAccess::exists(p_preset->get("custom_template/release")); rvalid = FileAccess::exists(p_preset->get("custom_template/release"));
if (!rvalid) { if (!rvalid) {
err += TTR("Custom release template not found.") + "\n"; template_err += TTR("Custom release template not found.") + "\n";
} }
} else {
rvalid = exists_export_template("android_release.apk", &template_err);
} }
valid = dvalid || rvalid; valid = dvalid || rvalid;
if (!valid) {
err += template_err;
}
} else { } else {
valid = exists_export_template("android_source.zip", &err); valid = exists_export_template("android_source.zip", &err);
} }