From 573db646a3b5716621c25e70252e5e1b08f7719d Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Sun, 1 Nov 2015 07:53:38 -0800 Subject: [PATCH] Fix embed for runtime-generated asset files --- lime/tools/platforms/AndroidPlatform.hx | 15 ++++++++++++++- lime/tools/platforms/BlackBerryPlatform.hx | 15 ++++++++++++++- lime/tools/platforms/EmscriptenPlatform.hx | 13 +++++++++++++ lime/tools/platforms/IOSPlatform.hx | 13 +++++++++++++ lime/tools/platforms/LinuxPlatform.hx | 13 +++++++++++++ lime/tools/platforms/MacPlatform.hx | 13 +++++++++++++ lime/tools/platforms/TVOSPlatform.hx | 13 +++++++++++++ lime/tools/platforms/TizenPlatform.hx | 14 ++++++++++++++ lime/tools/platforms/WebOSPlatform.hx | 14 ++++++++++++++ lime/tools/platforms/WindowsPlatform.hx | 13 +++++++++++++ 10 files changed, 134 insertions(+), 2 deletions(-) diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx index 86c8a997f..f058d2dfe 100644 --- a/lime/tools/platforms/AndroidPlatform.hx +++ b/lime/tools/platforms/AndroidPlatform.hx @@ -254,7 +254,20 @@ class AndroidPlatform extends PlatformTarget { public override function update ():Void { - //project = project.clone (); + project = project.clone (); + + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } //initialize (project); diff --git a/lime/tools/platforms/BlackBerryPlatform.hx b/lime/tools/platforms/BlackBerryPlatform.hx index 1bd80168e..71bf65b4c 100644 --- a/lime/tools/platforms/BlackBerryPlatform.hx +++ b/lime/tools/platforms/BlackBerryPlatform.hx @@ -259,9 +259,22 @@ class BlackBerryPlatform extends PlatformTarget { public override function update ():Void { - //project = project.clone (); + project = project.clone (); //initialize (project); + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + if (!project.targetFlags.exists ("html5")) { for (asset in project.assets) { diff --git a/lime/tools/platforms/EmscriptenPlatform.hx b/lime/tools/platforms/EmscriptenPlatform.hx index 1258a0817..f173e9ff8 100644 --- a/lime/tools/platforms/EmscriptenPlatform.hx +++ b/lime/tools/platforms/EmscriptenPlatform.hx @@ -244,6 +244,19 @@ class EmscriptenPlatform extends PlatformTarget { project = project.clone (); + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + for (asset in project.assets) { asset.resourceName = "assets/" + asset.resourceName; diff --git a/lime/tools/platforms/IOSPlatform.hx b/lime/tools/platforms/IOSPlatform.hx index d4fa8e561..82045378f 100644 --- a/lime/tools/platforms/IOSPlatform.hx +++ b/lime/tools/platforms/IOSPlatform.hx @@ -368,6 +368,19 @@ class IOSPlatform extends PlatformTarget { project = project.clone (); + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/" + project.app.file + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var manifest = new Asset (); manifest.id = "__manifest__"; manifest.data = AssetHelper.createManifest (project); diff --git a/lime/tools/platforms/LinuxPlatform.hx b/lime/tools/platforms/LinuxPlatform.hx index 2ba6fc7f0..9c4ebfdc6 100644 --- a/lime/tools/platforms/LinuxPlatform.hx +++ b/lime/tools/platforms/LinuxPlatform.hx @@ -300,6 +300,19 @@ class LinuxPlatform extends PlatformTarget { project = project.clone (); //initialize (project); + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + if (project.targetFlags.exists ("xml")) { project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); diff --git a/lime/tools/platforms/MacPlatform.hx b/lime/tools/platforms/MacPlatform.hx index 6efd5b212..a91c6372d 100644 --- a/lime/tools/platforms/MacPlatform.hx +++ b/lime/tools/platforms/MacPlatform.hx @@ -282,6 +282,19 @@ class MacPlatform extends PlatformTarget { } + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var context = generateContext (); if (targetType == "cpp" && project.targetFlags.exists ("static")) { diff --git a/lime/tools/platforms/TVOSPlatform.hx b/lime/tools/platforms/TVOSPlatform.hx index 79899918d..1a4953109 100644 --- a/lime/tools/platforms/TVOSPlatform.hx +++ b/lime/tools/platforms/TVOSPlatform.hx @@ -335,6 +335,19 @@ class TVOSPlatform extends PlatformTarget { project = project.clone (); + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/" + project.app.file + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var manifest = new Asset (); manifest.id = "__manifest__"; manifest.data = AssetHelper.createManifest (project); diff --git a/lime/tools/platforms/TizenPlatform.hx b/lime/tools/platforms/TizenPlatform.hx index 0b6037fba..76a8a2975 100644 --- a/lime/tools/platforms/TizenPlatform.hx +++ b/lime/tools/platforms/TizenPlatform.hx @@ -161,6 +161,20 @@ class TizenPlatform extends PlatformTarget { public override function update ():Void { project = project.clone (); + + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var destination = targetDirectory + "/bin/"; PathHelper.mkdir (destination); diff --git a/lime/tools/platforms/WebOSPlatform.hx b/lime/tools/platforms/WebOSPlatform.hx index 01c98f91a..d8fe650c5 100644 --- a/lime/tools/platforms/WebOSPlatform.hx +++ b/lime/tools/platforms/WebOSPlatform.hx @@ -142,6 +142,20 @@ class WebOSPlatform extends PlatformTarget { public override function update ():Void { project = project.clone (); + + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var destination = targetDirectory + "/bin/"; PathHelper.mkdir (destination); diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx index a7ecce7dc..198d64c7d 100644 --- a/lime/tools/platforms/WindowsPlatform.hx +++ b/lime/tools/platforms/WindowsPlatform.hx @@ -275,6 +275,19 @@ class WindowsPlatform extends PlatformTarget { } + for (asset in project.assets) { + + if (asset.embed && asset.sourcePath == "") { + + var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); + PathHelper.mkdir (Path.directory (path)); + FileHelper.copyAsset (asset, path); + asset.sourcePath = path; + + } + + } + var context = generateContext (); if (targetType == "cpp" && project.targetFlags.exists ("static")) {