Read exported version code from gdscript

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

Hey all,

is there a way to read from gdscript the Exported Version ?
For example in Android export dialog, we set the version code and version name.

That would be helpful to display to the user.


Good question, and makes me wonder what the point of setting the version number/name is when exporting (especially for Windows)?

SteveSmith | 2023-01-05 14:39

:bust_in_silhouette: Reply From: jptester

Try adding your own property to the project and then read it with:

:bust_in_silhouette: Reply From: dpensky

You can do something like this:

if OS.get_name() == "Android":
	var export_config: ConfigFile =
	var err = export_config.load("res://export_presets.cfg")
	if err == OK:
		print(export_config.get_value("preset.1.options", 'version/code'))
		print(export_config.get_value("preset.1.options", 'version/name'))
		print('[engine_root] Error open export_presets.cfgs')

export_presets.cfg need to be added manually to list of files to be exported

maybe you will need to change this param “preset.1.options”

Epic, works like a charm and saved my day :slight_smile:

SilvanaBanana | 2021-06-22 08:48