本文整理汇总了Java中org.apache.commons.lang3.SystemUtils.IS_OS_MAC属性的典型用法代码示例。如果您正苦于以下问题:Java SystemUtils.IS_OS_MAC属性的具体用法?Java SystemUtils.IS_OS_MAC怎么用?Java SystemUtils.IS_OS_MAC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.lang3.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.IS_OS_MAC属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNodeHeight
/**
* Sets the node height used for drawing.
* <p>
* Also updates the font size used for drawing sequences within nodes.
*
* @param nodeHeight the node height
*/
public final void setNodeHeight(final double nodeHeight) {
this.nodeHeight = nodeHeight;
this.snpHeight = nodeHeight * SNP_HEIGHT_FACTOR;
final Text text = new Text("X");
text.setFont(new Font(DEFAULT_NODE_FONT, 1));
final double font1PHeight = text.getLayoutBounds().getHeight();
final String font;
if (SystemUtils.IS_OS_MAC) {
font = DEFAULT_MAC_NODE_FONT;
} else {
font = DEFAULT_NODE_FONT;
}
final double fontSize = DEFAULT_NODE_FONT_HEIGHT_SCALAR * nodeHeight / font1PHeight;
this.nodeFont = new Font(font, fontSize);
text.setFont(nodeFont);
this.charWidth = text.getLayoutBounds().getWidth();
this.charHeight = text.getLayoutBounds().getHeight();
}
示例2: init
@PostConstruct
public void init() {
if (SystemUtils.IS_OS_LINUX) {
usersPath = environment.getProperty("image.path.linux.users");
formsPath = environment.getProperty("image.path.linux.forms");
} else if (SystemUtils.IS_OS_MAC) {
usersPath = environment.getProperty("image.path.mac.users");
formsPath = environment.getProperty("image.path.mac.forms");
} else if (SystemUtils.IS_OS_WINDOWS) {
usersPath = environment.getProperty("image.path.windows.users");
formsPath = environment.getProperty("image.path.windows.forms");
}
userContext = environment.getProperty("image.context.user");
formContext = environment.getProperty("image.context.form");
}
示例3: getSteamDir
public static File getSteamDir() throws RegistryException, IOException {
if (null == steamDir) {
if(SystemUtils.IS_OS_WINDOWS) {
steamDir = test(new File(WindowsRegistry.getInstance().readString(HKey.HKCU, "Software\\Valve\\Steam", "SteamPath")));
} else if(SystemUtils.IS_OS_MAC) {
steamDir = test(new File(SystemUtils.getUserHome()+"/Library/Application Support/Steam"));
} else if(SystemUtils.IS_OS_LINUX) {
ArrayList<File> fl = new ArrayList<>();
fl.add(new File(SystemUtils.getUserHome()+"/.steam/steam"));
fl.add(new File(SystemUtils.getUserHome()+"/.steam/Steam"));
fl.add(new File(SystemUtils.getUserHome()+"/.local/share/steam"));
fl.add(new File(SystemUtils.getUserHome()+"/.local/share/Steam"));
steamDir = test(fl);
}
}
return steamDir;
}
示例4: getConfigBasePathForAll
/**
* 获得全平台的基础路径<br>
* 真正的跨平台!
* @author Administrator
* @return
*/
public static String getConfigBasePathForAll()
{
String ret = "";
//根据操作系统决定真正的配置路径
if (SystemUtils.IS_OS_WINDOWS)
{
ret = FileKit.getMyConfigBasePathForWindows();
}
else if (SystemUtils.IS_OS_LINUX)
{
ret = CONFIG_BASEPATH_LINUX;
}
else if (SystemUtils.IS_OS_MAC)
{
ret = CONFIG_BASEPATH_MAC;
}
else
{
//其他情况下,都是类Unix的系统,因此均采用Linux的路径设置
ret = CONFIG_BASEPATH_LINUX;
}
return ret;
}
示例5: getEditor
public String[] getEditor() {
if (StringUtils.isEmpty(this.editor)) {
if (SystemUtils.IS_OS_WINDOWS) {
return new String[]{"notepad.exe"};
}
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
return new String[]{"vim"};
}
return new String[]{"vim"};
} else {
return BashUtils.parseArguments(this.editor);
}
}
示例6: fillOS
private static String fillOS(){
String os = null;
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) os = "mac";
else if (SystemUtils.IS_OS_UNIX) os = "linux";
else if (SystemUtils.IS_OS_WINDOWS) os = "windows";
return os;
}
示例7: updateStage
public static void updateStage(){
String mode = Main.getProperties().getString("character.layer_mode");
if(mode == null){
if(SystemUtils.IS_OS_MAC) mode = "SEPARATE";
else mode = "ALWAYS_TOP";
}
updateStage(mode);
}
示例8: getModDir
public static File getModDir() throws IOException {
if (null == modDir) {
if(SystemUtils.IS_OS_WINDOWS) {
modDir = test(new File(SystemUtils.getUserHome() + "\\Documents\\Paradox Interactive\\Stellaris\\mod"));
} else if(SystemUtils.IS_OS_MAC) {
modDir = test(new File(SystemUtils.getUserHome() + "/Documents/Paradox Interactive/Stellaris/mod"));
} else if(SystemUtils.IS_OS_LINUX) {
modDir = test(new File(SystemUtils.getUserHome() + "/.local/share/Paradox Interactive/Stellaris/mod"));
}
}
return modDir;
}
示例9: updatePath
private static void updatePath() {
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX) {
Map<String, String> env = System.getenv();
String path = env.get("PATH");
Map<String, String> envNew = new HashMap<>(env);
envNew.put("PATH", path + ":/usr/local/bin");
try {
Utils.setEnv(envNew);
} catch (Exception ex) {
throw new EntityCommunicationException(ex);
}
}
}
示例10: capture
public static BufferedImage capture(int width, int height, Consumer<Graphics2D> painter)
throws Exception {
JFrame[] f = new JFrame[1];
Point[] p = new Point[1];
SwingUtilities.invokeAndWait(() -> {
f[0] = new JFrame();
JComponent c = new MyComponent(painter);
f[0].add(c);
c.setSize(width + 10, height + 10);
f[0].setSize(width + 100, height + 100); // giving some space
// for frame border effects,
// e.g. rounded frame
c.setLocation(50, 50);
f[0].setVisible(true);
p[0] = c.getLocationOnScreen();
});
Rectangle screenRect;
Robot r = new Robot();
while (!Color.black.equals(r.getPixelColor(p[0].x, p[0].y))) {
Thread.sleep(100);
}
screenRect = new Rectangle(p[0].x + 5, p[0].y + 5, width, height);
BufferedImage result = SystemUtils.IS_OS_MAC ?
captureScreen(f[0], screenRect) : r.createScreenCapture(screenRect);
SwingUtilities.invokeAndWait(f[0]::dispose);
return result;
}
示例11: getRecorder
public static IVideoRecorder getRecorder(RecorderType recorderType) {
if (recorderType.equals(RecorderType.FFMPEG)) {
if (SystemUtils.IS_OS_WINDOWS) {
return new WindowsFFmpegRecorder();
} else if (SystemUtils.IS_OS_MAC) {
return new MacFFmpegRecorder();
}
return new LinuxFFmpegRecorder();
}
return new MonteRecorder();
}
示例12: getURL
private static URL getURL(String version) {
StringBuilder url = new StringBuilder();
url.append("https://releases.hashicorp.com/vault/").append(version).append("/vault_").append(version).append("_");
if (SystemUtils.IS_OS_MAC) {
url.append("darwin_");
} else if (SystemUtils.IS_OS_LINUX) {
url.append("linux_");
} else if (SystemUtils.IS_OS_WINDOWS) {
url.append("windows_");
} else {
throw new IllegalStateException("Unsupported operating system");
}
if (ArchUtils.getProcessor().is64Bit()) {
url.append("amd64.zip");
} else {
url.append("386.zip");
}
System.out.println("Downloading " + url.toString());
try {
return new URL(url.toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例13: DockerComposeRuntime
public DockerComposeRuntime(Carnotzet carnotzet, String instanceId, CommandRunner commandRunner) {
// Due to limitations in docker for mac and windows, mapping local ports to container ports is the preferred technique for those users.
// https://docs.docker.com/docker-for-mac/networking/#i-cannot-ping-my-containers
this(carnotzet, instanceId, commandRunner, SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS);
}
示例14: ChromeWebDriverFactory
public ChromeWebDriverFactory() {
super( //
BrowserType.CHROME, //
(targetDirectory) -> {
final String extension = getExecutableExtension(true);
final Pattern executablePattern =
Pattern.compile("chromedriver-(?<version>.*)" + extension);
final File[] files =
targetDirectory.listFiles(new PatternFilenameFilter(executablePattern));
if (files == null || files.length != 1) {
return Optional.empty();
}
final File executable = files[0];
final Matcher executableMatcher = executablePattern.matcher(executable.getName());
if (!executableMatcher.find()) {
throw new IllegalStateException(
String.format("Unable to determine version of executable %s", executable));
}
final String version = executableMatcher.group("version");
return Optional
.of(new DownloadWebDriverExecutable.WebDriverExecutable(executable, version));
}, //
() -> getString(LATEST_RELEASE_URL), //
(version, targetDirectory) -> {
final String system;
if (SystemUtils.IS_OS_WINDOWS) {
system = "win32";
} else if (SystemUtils.IS_OS_MAC) {
system = "mac64";
} else if (SystemUtils.IS_OS_LINUX) {
final StringBuilder linuxBuilder = new StringBuilder("linux");
// TODO this property does not reflect the OS architecture, it is the VM`s "bitness"
if (SystemUtils.OS_ARCH.contains("64")) {
linuxBuilder.append("64");
} else {
linuxBuilder.append("32");
}
system = linuxBuilder.toString();
} else {
throw new UnsupportedOperationException(
String.format("Unsupported operation system: %s %s", SystemUtils.OS_NAME,
SystemUtils.OS_VERSION));
}
LOGGER.debug("System '{}' detected.", system);
final String downloadUrl =
DOWNLOAD_URL + String.format("/%s/chromedriver_%s.zip", version, system);
LOGGER.debug("Download chromedriver from {}", downloadUrl);
downloadZipAndExtract(downloadUrl, targetDirectory);
final File chromeDriverFile = new File(targetDirectory,
String.format("chromedriver%s", getExecutableExtension(false)));
final File chromeDriverFileWithVersion = new File(targetDirectory,
String.format("chromedriver-%s%s", version, getExecutableExtension(false)));
if (!chromeDriverFile.renameTo(chromeDriverFileWithVersion)) {
throw new RuntimeException();
}
if (!chromeDriverFileWithVersion.setExecutable(true, false)) {
throw new RuntimeException();
}
return new DownloadWebDriverExecutable.WebDriverExecutable(chromeDriverFileWithVersion,
version);
}, //
ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY //
);
}
示例15: newWebDriver
/**
* Construct the {@link WebDriver} instance to be used.
*
* @param browser The web browser to use.
*/
private static WebDriver newWebDriver(final Browser browser) {
final String driver, os;
// Determine driver
switch (browser) {
case FIREFOX:
driver = "gecko";
break;
case CHROME:
driver = "chrome";
break;
default:
throw new IllegalArgumentException("Invalid browser: " + browser);
}
// Determine os
if (SystemUtils.IS_OS_WINDOWS) {
os = "win.exe";
} else if (SystemUtils.IS_OS_MAC) {
os = "mac";
} else if (SystemUtils.IS_OS_LINUX) {
os = "linux";
} else {
throw new UnsupportedOperationException("Unsupported OS: " + SystemUtils.OS_NAME);
}
// Install driver file into temp directory
InputStream src = null;
OutputStream dest = null;
try {
// Create temp file
File tmp = FB2GHUtils.createTempFile(driver + "driver-" + os);
// Initialize streams
src = GHAttachmentUploader.class.getResourceAsStream(driver + "driver-" + os);
dest = new FileOutputStream(tmp);
// Copy driver to temp file
IOUtils.copy(src, dest);
if (!tmp.setExecutable(true)) {
logger.warn("Failed to set access permissions of file: {}", tmp);
}
// Set driver property
String key = "webdriver." + driver + ".driver";
String value = URLDecoder.decode(tmp.getAbsolutePath(), "UTF-8");
System.setProperty(key, value);
logger.info("System property '{}' was set to '{}'.", key, value);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtils.closeQuietly(src);
IOUtils.closeQuietly(dest);
}
// Return WebDriver
switch (browser) {
case FIREFOX:
return new FirefoxDriver();
case CHROME:
return new ChromeDriver();
default:
throw new IllegalArgumentException("Invalid browser: " + browser);
}
}