make headless patch work for product.app folder as well

This commit is contained in:
Konstantin Bulenkov
2016-08-11 23:07:01 +02:00
parent d399de95f4
commit 11ddfa29ac
@@ -25,6 +25,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* @author Konstantin Bulenkov
@@ -38,6 +39,12 @@ public class Bootstrap {
InvocationTargetException, IllegalAccessException, InterruptedException {
if (args.length != 1) return;
String path = args[0].endsWith("\\") || args[0].endsWith("/") ? args[0] : args[0] + File.separator;
if (isMac() && path.endsWith(".app/")) {
final File file = new File(path + "Contents");
if (file.exists() && file.isDirectory()) {
path += "Contents/";
}
}
cleanUp();
@@ -107,4 +114,8 @@ public class Bootstrap {
//noinspection CallToPrintStackTrace
ex.printStackTrace();
}
private static boolean isMac() {
return System.getProperty("os.name").toLowerCase(Locale.US).startsWith("mac");
}
}