Don't require Java in order to build, skip SVG rasterizer when Java runtime not detected on Mac

This commit is contained in:
Joshua Granick
2014-10-27 10:55:33 -07:00
parent 565c44b99b
commit f6c2c3abef

View File

@@ -7,6 +7,7 @@ package helpers;
//import openfl.geom.Matrix;
import lime.graphics.Image;
import project.Haxelib;
import project.Platform;
import sys.FileSystem;
//import format.SVG;
@@ -35,6 +36,36 @@ class ImageHelper {
args.push (path);
if (PlatformHelper.hostPlatform == Platform.MAC) {
try {
var found = false;
if (FileSystem.exists ("/System/Library/Java/JavaVirtualMachines")) {
found = (FileSystem.readDirectory ("/System/Library/Java/JavaVirtualMachines").length > 0);
}
if (FileSystem.exists ("/Library/Java/JavaVirtualMachines")) {
found = (FileSystem.readDirectory ("/Library/Java/JavaVirtualMachines").length > 0);
}
if (!found) {
if (LogHelper.verbose) LogHelper.warn ("Skipping SVG to PNG rasterization step, no Java runtime detected");
return null;
}
} catch (e:Dynamic) {}
}
if (LogHelper.verbose) {
ProcessHelper.runCommand ("", "java", args, true, true);