下面列出了org.apache.commons.lang.SystemUtils#IS_OS_MAC_OSX 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Where everything starts. Takes in, and tries to parse as many commandline arguments as possible.
* Otherwise, it launches a GUI.
*
* @param args Array of command line arguments.
*/
public static void main(String[] args) throws MalformedURLException {
CommandLine cl = getArgs(args);
if (args.length > 0 && cl.hasOption('v')){
logger.info(UpdateUtils.getThisJarVersion());
System.exit(0);
}
if (Utils.getConfigString("proxy.http", null) != null) {
Proxy.setHTTPProxy(Utils.getConfigString("proxy.http", null));
} else if (Utils.getConfigString("proxy.socks", null) != null) {
Proxy.setSocks(Utils.getConfigString("proxy.socks", null));
}
// This has to be here instead of handleArgs because handleArgs isn't parsed until after a item is ripper
if (cl.hasOption("a")) {
logger.info(cl.getOptionValue("a"));
stringToAppendToFoldername = cl.getOptionValue("a");
}
if (GraphicsEnvironment.isHeadless() || args.length > 0) {
handleArguments(args);
} else {
if (SystemUtils.IS_OS_MAC_OSX) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "RipMe");
}
Utils.configureLogger();
logger.info("Initialized ripme v" + UpdateUtils.getThisJarVersion());
MainWindow mw = new MainWindow();
SwingUtilities.invokeLater(mw);
}
}
private static CharSequence getOS() {
if (SystemUtils.IS_OS_LINUX) {
return "linux";
} else if (SystemUtils.IS_OS_WINDOWS) {
return "win32";
} else if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
return "macosx";
} else {
throw new IllegalArgumentException("Unsupported OS");
}
}
@Override
protected boolean isApplicable() {
final boolean nettyDoesSupportMacUnixSockets = SystemUtils.IS_OS_MAC_OSX &&
ComparableVersion.OS_VERSION.isGreaterThanOrEqualTo("10.12");
return SystemUtils.IS_OS_LINUX || nettyDoesSupportMacUnixSockets;
}
@BeforeClass
public static void setUpBeforeClass() {
// set the NO_EVENT_TIMEOUT_IN_SECONDS according to the operating system used
if (SystemUtils.IS_OS_MAC_OSX) {
NO_EVENT_TIMEOUT_IN_SECONDS = 15;
} else {
NO_EVENT_TIMEOUT_IN_SECONDS = 3;
}
}
@Override
public EventLoopGroup init(Bootstrap bootstrap, DockerClientConfig dockerClientConfig) {
if (SystemUtils.IS_OS_LINUX) {
return epollGroup();
} else if (SystemUtils.IS_OS_MAC_OSX) {
return kqueueGroup();
}
throw new RuntimeException("Unsupported OS");
}
/**
* Figure out where the tools.jar file lives.
*/
private URL findToolsJar() throws MojoExecutionException {
final File javaHome = FileUtils.resolveFile(new File(File.pathSeparator), System.getProperty("java.home"));
final List<File> toolsPaths = new ArrayList<File>();
File file = null;
if (SystemUtils.IS_OS_MAC_OSX) {
file = FileUtils.resolveFile(javaHome, "../Classes/classes.jar");
toolsPaths.add(file);
}
if (file == null || !file.exists()) {
file = FileUtils.resolveFile(javaHome, "../lib/tools.jar");
toolsPaths.add(file);
}
if (!file.exists()) {
throw new MojoExecutionException("Could not find tools.jar at " + toolsPaths + " under java.home: " + javaHome);
}
getLog().debug("Using tools.jar: " + file);
final URI fileUri = file.toURI();
try {
return fileUri.toURL();
}
catch (MalformedURLException e) {
throw new MojoExecutionException("Could not generate URL from URI: " + fileUri, e);
}
}