better Xcode installation check

This commit is contained in:
Ben Fry
2015-08-19 16:57:38 -04:00
parent 76856d3e8c
commit 77917933c4

View File

@@ -1186,7 +1186,7 @@ public class JavaBuild {
pw.close();
// attempt to code sign if the Xcode tools appear to be installed
if (Platform.isMacOS() && new File("/usr/bin/codesign_allocate").exists()) {
if (Platform.isMacOS() && isXcodeInstalled()) {
if (embedJava) {
ProcessHelper.ffs("codesign", "--force", "--sign", "-", jdkPath);
}
@@ -1334,6 +1334,21 @@ public class JavaBuild {
}
static Boolean xcodeInstalled;
static protected boolean isXcodeInstalled() {
if (xcodeInstalled == null) {
Process p = PApplet.launch("xcode-select", "-p");
int result = -1;
try {
result = p.waitFor();
} catch (InterruptedException e) { }
xcodeInstalled = (result == 0);
}
return xcodeInstalled;
}
/**
* Run the launch4j build.xml file through ant to create the exe.
* Most of this code was lifted from Android mode.