Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to Android: improve Invalid package name error message by showing Project name converted to $genname explicitly #8947

Closed
hsandt opened this issue Jan 23, 2024 · 1 comment

Comments

@hsandt
Copy link

hsandt commented Jan 23, 2024

Describe the project you are working on

A platformer

Describe the problem or limitation you are having in your project

This issue: godotengine/godot#71645
and its PR: godotengine/godot#71646
added an error message to predict when the Project name converted to package basename would give an invalid package name (e.g. when it contains spaces).

However, the error message doesn't show the generated basename, so it's hard to tell what's wrong.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

We could add the generated basename to the error message.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Instead of

"The project name does not meet the requirement for the package name format. Please explicitly specify the package name."

we would inject the Project name and the bad name generated from it. We could also suggest to change Project Name. We could also add the cause of invalidity.

In fact, in the same PR, more below, we can see another error message "Invalid package name:" that actually states the error reason, so we could reuse this.

"The project name '{ProjectName}', once converted to package name '{$genname}', does not meet the requirement for the package name format: {ErrorReason}. Please either change the project name or explicitly specify the package name."

Ex:

"The project name '00My Game', once converted to package name 'My Game', does not meet the requirement for the package name format: the character ' ' is not allowed in Android application package names. Please either change the project name or explicitly specify the package name."

For the error message, I reused the existing one visible in the Export popup when manually inputting an invalid package name, e.g. with spaces or hyphens:

image

In addition, to reduce the amount of errors happening during auto-convert, we could improve the EditorExportPlatformAndroid::get_valid_basename method to strip invalid characters even better.

To be honest, I'm not sure why get_valid_basename is called that way if it doesn't really return a valid basename for $genname. Shouldn't it replace spaces and hyphens with underscores and remove complex symbols? It would be much easier to debug though if the advanced error message I suggested above was implemented.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It happens in project settings so not really.

Is there a reason why this should be core and not an add-on in the asset library?

It happens in project settings so not really.

@m4gr3d
Copy link

m4gr3d commented Jun 23, 2024

Fixed in godotengine/godot#84676

@m4gr3d m4gr3d closed this as completed Jun 23, 2024
@Calinou Calinou added this to the 4.3 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants