Getting the app version (nowadays) at runtime

I’m trying to figure out how to get the app’s version within haxe code, as defined in openfl’s project.xml.

I found snippets like:

Get OpenFL version at runtime/macro? – doesn’t tell me the app version (I looked in the HXML)

https://muut.com/openfl#!/openfl/programming:how-to-get-app-version-at-h – same as the above (also I tried <haxedef name="APP_VERSION" value="${APP_VERSION}" /> hopefully with it, but it comes out “APP_VERSION=APP_VERSION” in hxml

http://www.openfl.org/archive/community/programming-haxe/access-application-metadata-run-time-nmelib-something-else/ – Lib.version doesn’t seem to exist anymore according to the dropdown I get in HaxeDevelop when I type “Lib.” nor if I search Lib.hx myself? Also just trying the ::-style macros gives me compiler errors (“Unexpected :”).

I’m on 3.6.1, windows/cpp. Are any of these techniques still in use by folks nowadays? If not, what’s the secret?

Thanks for any help,
KJB of IBwWG

Never mind, there is a Lib.version, and it works. I keep forgetting that I can’t just go to openfl source and search within the apparently-relevant file, because haxeflixel uses legacy, not next, so I have to go not where haxedevelop sends me, but into the _legacy directory, and ignore what it gives me in autocompletion dropdowns too. :slight_smile:

It’s stage.application.config.version, I believe, if anyone is looking for this in the current version :slight_smile:

1 Like

Thanks @singmajesty, do you mean Lib.version is gone post-3.6.1? Or you mean in openfl “next”?

Using OpenFL 3 and -Dlegacy, Lib.version should work, but otherwise, Lib.version is not part of the API

1 Like