diff --git a/include.xml b/include.xml
index 79587d08f..b622e7d11 100644
--- a/include.xml
+++ b/include.xml
@@ -47,6 +47,8 @@
+
+
diff --git a/lime/tools/helpers/FlashHelper.hx b/lime/tools/helpers/FlashHelper.hx
index 97661b233..2730e875a 100644
--- a/lime/tools/helpers/FlashHelper.hx
+++ b/lime/tools/helpers/FlashHelper.hx
@@ -570,6 +570,29 @@ class FlashHelper {
}*/
+ public static function enableLogging ():Void {
+
+ try {
+
+ var path = switch (PlatformHelper.hostPlatform) {
+
+ case WINDOWS: Sys.getEnv ("HOMEDRIVE") + "/" + Sys.getEnv ("HOMEPATH") + "/mm.cfg";
+ case MAC: "/Library/Application Support/Macromedia/mm.cfg";
+ default: Sys.getEnv ("HOME") + "/mm.cfg";
+
+ }
+
+ if (!FileSystem.exists (path)) {
+
+ File.saveContent (path, "ErrorReportingEnable=1\nTraceOutputFileEnable=1\nMaxWarnings=50");
+
+ }
+
+ } catch (e:Dynamic) {}
+
+ }
+
+
private static function compileSWC (project:HXProject, assets:Array, id:Int):Void {
#if format
@@ -874,6 +897,31 @@ class FlashHelper {
}
+ public static function getLogLength ():Int {
+
+ try {
+
+ var path = switch (PlatformHelper.hostPlatform) {
+
+ case WINDOWS: PathHelper.escape (Sys.getEnv ("APPDATA") + "/Macromedia/Flash Player/Logs/flashlog.txt");
+ case MAC: Sys.getEnv ("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt";
+ default: Sys.getEnv ("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
+
+ }
+
+ if (FileSystem.exists (path)) {
+
+ return FileSystem.stat (path).size;
+
+ }
+
+ } catch (e:Dynamic) { }
+
+ return 0;
+
+ }
+
+
private static function nextAssetID () {
return swfAssetID++;
@@ -903,5 +951,65 @@ class FlashHelper {
}
-
+
+ public static function tailLog (start:Int = 0):Void {
+
+ try {
+
+ var path = switch (PlatformHelper.hostPlatform) {
+
+ case WINDOWS: PathHelper.escape (Sys.getEnv ("APPDATA") + "/Macromedia/Flash Player/Logs/flashlog.txt");
+ case MAC: Sys.getEnv ("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt";
+ default: Sys.getEnv ("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
+
+ }
+
+ var position = start;
+
+ if (FileSystem.exists (path)) {
+
+ while (true) {
+
+ Sys.sleep (1);
+ var input = null;
+
+ try {
+
+ input = File.read (path, false);
+ input.seek (position, FileSeek.SeekBegin);
+
+ if (!input.eof ()) {
+
+ var bytes = input.readAll ();
+ position = input.tell ();
+
+ if (bytes.length > 0) {
+
+ Sys.print (bytes.getString (0, bytes.length));
+
+ }
+
+ }
+
+ input.close ();
+
+ } catch (e:Dynamic) {
+
+ if (input != null) {
+
+ input.close ();
+
+ }
+
+ }
+
+ }
+
+ }
+
+ } catch (e:Dynamic) {}
+
+ }
+
+
}
diff --git a/lime/tools/platforms/FlashPlatform.hx b/lime/tools/platforms/FlashPlatform.hx
index 37e479ae7..0852c2312 100644
--- a/lime/tools/platforms/FlashPlatform.hx
+++ b/lime/tools/platforms/FlashPlatform.hx
@@ -24,6 +24,7 @@ class FlashPlatform extends PlatformTarget {
private var embedded:Bool;
+ private var logLength:Int;
public function new (command:String, _project:HXProject, targetFlags:Map ) {
@@ -194,6 +195,13 @@ class FlashPlatform extends PlatformTarget {
public override function run ():Void {
+ if (traceEnabled) {
+
+ FlashHelper.enableLogging ();
+ //logLength = FlashHelper.getLogLength ();
+
+ }
+
if (project.app.url != null && project.app.url != "") {
ProcessHelper.openURL (project.app.url);
@@ -209,7 +217,22 @@ class FlashPlatform extends PlatformTarget {
}
- FlashHelper.run (project, destination, targetPath);
+ if (traceEnabled) {
+
+ neko.vm.Thread.create (function () {
+
+ FlashHelper.run (project, destination, targetPath);
+ Sys.exit (0);
+
+ });
+
+ Sys.sleep (0.1);
+
+ } else {
+
+ FlashHelper.run (project, destination, targetPath);
+
+ }
}
@@ -272,6 +295,13 @@ class FlashPlatform extends PlatformTarget {
}
+ public override function trace ():Void {
+
+ FlashHelper.tailLog (0);
+
+ }
+
+
/*private function getIcon (size:Int, targetPath:String):Void {
var icon = icons.findIcon (size, size);
@@ -291,7 +321,6 @@ class FlashPlatform extends PlatformTarget {
@ignore public override function install ():Void {}
@ignore public override function rebuild ():Void {}
- @ignore public override function trace ():Void {}
@ignore public override function uninstall ():Void {}
}