Created
September 14, 2013 15:16
-
-
Save Dvergar/6562832 to your computer and use it in GitHub Desktop.
Macro to get project version from an OpenFL project file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if macro | |
| import sys.io.File; | |
| #end | |
| import haxe.macro.Expr; | |
| import haxe.macro.Context; | |
| class VersionMacro | |
| { | |
| macro public static function getGameVersion(projectFileName:String):Expr | |
| { | |
| var xml = Xml.parse(File.getContent("./" + projectFileName)); | |
| var fast = new haxe.xml.Fast(xml.firstElement()); | |
| return Context.makeExpr(fast.node.meta.att.version, Context.currentPos()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment