Merge pull request #84676 from m4gr3d/update_package_name_validation_logic

Update the validation logic for the package name
This commit is contained in:
Yuri Sizov 2023-12-08 15:23:23 +01:00
commit 62b264e6ac
1 changed files with 8 additions and 8 deletions

View File

@ -460,7 +460,7 @@ String EditorExportPlatformAndroid::get_valid_basename() const {
if (is_digit(c) && first) {
continue;
}
if (is_ascii_alphanumeric_char(c)) {
if (is_ascii_identifier_char(c)) {
name += String::chr(c);
first = false;
}
@ -537,13 +537,6 @@ bool EditorExportPlatformAndroid::is_package_name_valid(const String &p_package,
return false;
}
if (p_package.find("$genname") >= 0 && !is_project_name_valid()) {
if (r_error) {
*r_error = TTR("The project name does not meet the requirement for the package name format. Please explicitly specify the package name.");
}
return false;
}
return true;
}
@ -2446,6 +2439,13 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
err += "\n";
}
String package_name = p_preset->get("package/unique_name");
if (package_name.find("$genname") >= 0 && !is_project_name_valid()) {
// Warning only, so don't override `valid`.
err += vformat(TTR("The project name does not meet the requirement for the package name format and will be updated to \"%s\". Please explicitly specify the package name if needed."), get_valid_basename());
err += "\n";
}
r_error = err;
return valid;
}