Skip to content

Instantly share code, notes, and snippets.

@Dvergar
Created September 14, 2013 15:16
Show Gist options
  • Select an option

  • Save Dvergar/6562832 to your computer and use it in GitHub Desktop.

Select an option

Save Dvergar/6562832 to your computer and use it in GitHub Desktop.
Macro to get project version from an OpenFL project file
#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