Unify asset copying code, and standardize asset embedding.
Having eight separate implementations made it harder to maintain. While an asset embedding bug got fixed on desktop targets, it got overlooked on others. This lead to assets being included twice on those other targets: once embedded, and once normally. (#1898) Now, that behavior is controlled from one place, and the bug is fixed for eight targets at once. This also standardizes the case of `asset.embed == true && asset.type == TEMPLATE`. Previously, some targets would prioritze `embed` over `type`, embedding the template into the app without even processing it as a template. Now, it will always prioritize `type`, processing templates as templates and never trying to embed them. Three targets are left out since they have more complex asset embedding behavior. I haven't checked if the bug is present on any of those.
This commit is contained in:
@@ -203,17 +203,6 @@ class TizenPlatform extends PlatformTarget
|
||||
|
||||
// project = project.clone ();
|
||||
|
||||
for (asset in project.assets)
|
||||
{
|
||||
if (asset.embed && asset.sourcePath == "")
|
||||
{
|
||||
var path = Path.combine(targetDirectory + "/obj/tmp", asset.targetPath);
|
||||
System.mkdir(Path.directory(path));
|
||||
AssetHelper.copyAsset(asset, path);
|
||||
asset.sourcePath = path;
|
||||
}
|
||||
}
|
||||
|
||||
var destination = targetDirectory + "/bin/";
|
||||
System.mkdir(destination);
|
||||
|
||||
@@ -256,30 +245,9 @@ class TizenPlatform extends PlatformTarget
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "haxe", targetDirectory + "/haxe", context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "tizen/hxml", targetDirectory + "/haxe", context);
|
||||
|
||||
for (asset in project.assets)
|
||||
{
|
||||
var path = Path.combine(destination + "res/", asset.targetPath);
|
||||
|
||||
System.mkdir(Path.directory(path));
|
||||
|
||||
if (asset.type != AssetType.TEMPLATE)
|
||||
{
|
||||
if (asset.targetPath == "/appinfo.json")
|
||||
{
|
||||
AssetHelper.copyAsset(asset, path, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
// going to root directory now, but should it be a forced "assets" folder later?
|
||||
|
||||
AssetHelper.copyAssetIfNewer(asset, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetHelper.copyAsset(asset, path, context);
|
||||
}
|
||||
}
|
||||
// going to root directory now, but should it be a forced "assets" folder later?
|
||||
copyProjectAssets(destination + "res/", "");
|
||||
// copyProjectAssets(destination + "res/", "assets");
|
||||
}
|
||||
|
||||
@ignore public override function install():Void {}
|
||||
|
||||
Reference in New Issue
Block a user