-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add function to get exported application version / product version #372
Comments
Is that not what |
tested just now on 3.2b5 it return 'official' And I mean is not the engine version but version of the game you exported. The version that you type in Export Preset > Options |
You can define a custom project setting for this purpose (e.g. |
Maybe store the value somewhere on export? |
Reading from the executable is something I'd consider overkill. It's also not possible on all platforms in the first place 🙂 Either way, my issue with this proposal is that not all platforms define the same metadata for each platform. If you want to access this metadata in a consistent manner cross platforms, you should define a project setting. To avoid repetition in export presets, we could do the following:
If this sounds good to you, I can look into implementing this. |
Yes, that's sounds good! |
Forget what I wrote, this works like a charm on droid. Only thing to do is to add export_presets.cfg to the exported files in the export dialog:
|
If you have an Android export preset, |
You don't need to include the whole export presets, you can create EditorExporPlugin that extracts version information to a file that will then be included with the build: func _export_begin(features: PoolStringArray, is_debug: bool, path: String, flags: int):
var version = ""
var export_config: ConfigFile = ConfigFile.new()
var err = export_config.load("res://export_presets.cfg")
if err == OK:
version = export_config.get_value("preset.1.options", 'version/code') + export_config.get_value("preset.1.options", 'version/name')
var script = GDScript.new()
script.source_code = str("extends Reference\nconst VERSION = ", version, "\n")
ResourceSaver.save("res://version.gd", script) Then anywhere in the project you can do |
Ok here's a plugin based on the above code: |
Here's a little method that should give the Android app version with an Android plugin. It's pretty simple and straightforward if you're already using a custom Android plugin.
|
This issue does beg the question, what is/was the point of the File Version/Product version fields when exporting to (say) Windows? Is it actually shown or used anywhere? |
It is available in the "Properties" dialog, if you right click on the executable. It is useful in some cases, but it's mostly useful to you as a developer, so you can attribute bugs and issues to a specific version. |
When I view my exe's properties I get the Godot version, and even the Product Name says "Godot Engine", even though I've specified my own in the Export settings. (Godot v3.4.2 in case it's relevant). |
Describe the project you are working on:
Irrelevant
Describe the problem or limitation you are having in your project:
You can't get the version of the app or game that you export.
Describe how this feature / enhancement will help you overcome this problem or limitation:
Make it easier to get version of my exported app.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
Irrelevant
Describe implementation detail for your proposal (in code), if possible:
In the export preset there is a version field, example:
Android: Preset > Options > Version > Name
Windows: Preset > Options > Application > Product Version
etc
So these version should be available to get from Godot API.
My suggestion would be:
OS.get_product_version()
or
OS.get_application_version()
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Right now I use the project setting to make custom string field to write my game version and get it using ProjectSettings.get_setting(). But is not so effective because I have to edit it manually whenever I update my app version in export preset.
Is there a reason why this should be core and not an add-on in the asset library?:
Because it is important.
The text was updated successfully, but these errors were encountered: