From f54528b9e211a56575c9e4d981c8586cbf1b2dbf Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 19 Dec 2016 21:00:50 -0800 Subject: [PATCH] Asset embed fix --- lime/_macros/AssetsMacro.hx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lime/_macros/AssetsMacro.hx b/lime/_macros/AssetsMacro.hx index 1e3a98a28..9eedb6ce6 100644 --- a/lime/_macros/AssetsMacro.hx +++ b/lime/_macros/AssetsMacro.hx @@ -79,7 +79,7 @@ class AssetsMacro { }; - var args = [ { name: "length", opt: false, type: macro :Int }, { name: "bytesData", opt: false, type: macro :haxe.io.BytesData } ]; + var args = [ { name: "length", opt: true, type: macro :Int }, { name: "bytesData", opt: true, type: macro :haxe.io.BytesData } ]; fields.push ({ name: "new", access: [ APublic ], kind: FFun({ args: args, expr: constructor, params: [], ret: null }), pos: Context.currentPos () }); #end @@ -159,12 +159,22 @@ class AssetsMacro { #else var path = filePath; + if (!sys.FileSystem.exists(filePath)) { + path = Context.resolvePath (filePath); + } + var bytes = File.getBytes (path); var resourceName = "__ASSET__" + metaName + "_" + (classType.pack.length > 0 ? classType.pack.join ("_") + "_" : "") + classType.name; + if (Context.getResources ().exists (resourceName)) { + + return null; + + } + if (encode) { var resourceType = "image/png";