List of usage examples for org.apache.commons.lang SystemUtils IS_OS_MAC
boolean IS_OS_MAC
To view the source code for org.apache.commons.lang SystemUtils IS_OS_MAC.
Click Source Link
Is true
if this is Mac.
The field will return false
if OS_NAME
is null
.
From source file:org.openoffice.maven.ConfigurationManager.java
/** * Returns the path to the SDK binaries depending on the OS and the * architecture./*from w w w . j a va2s.com*/ * * @param pHome * the OpenOffice.org SDK home * @return the full path to the SDK binaries */ private static String getSdkBinPath() { File sdkHome = Environment.getOoSdkHome(); // OOo SDK does not seem to include the target os in their packaging // anymore. Tested with 3.2.0 String path = "/bin"; if (new File(sdkHome, path).exists()) { return new File(sdkHome, path).getPath(); } // Get the Architecture properties String arch = System.getProperty("os.arch").toLowerCase(); if (SystemUtils.IS_OS_WINDOWS) { path = "/windows/bin/"; } else if (SystemUtils.IS_OS_SOLARIS) { if (arch.equals("sparc")) { path = "/solsparc/bin"; } else { path = "/solintel/bin"; } } else if (SystemUtils.IS_OS_MAC) { path = "/bin"; } else { path = "/linux/bin"; } return new File(sdkHome, path).getPath(); }
From source file:org.openoffice.maven.ConfigurationManager.java
/** * Returns the path to the OOO binaries depending on the OS and the * architecture./* www . j a va 2 s . co m*/ * * @return the full path to the OOo binaries */ private static String getOOoBinPath() { File oooHome = Environment.getOfficeHome(); File binDir = new File(oooHome, "program"); if (SystemUtils.IS_OS_MAC) { binDir = new File(oooHome, "Contents/MacOS"); } return binDir.getAbsolutePath(); }
From source file:org.openoffice.maven.ConfigurationManager.java
private static void setUpEnvironmentFor(final Commandline cl) throws Exception { cl.addSystemEnvironment();/*from w w w . j a v a2s . com*/ Properties envVars = cl.getSystemEnvVars(); String path = envVars.getProperty("PATH", ""); String pathSep = System.getProperty("path.separator", ":"); path = getSdkBinPath() + pathSep + getOOoBinPath() + pathSep + Environment.getOoSdkUreBinDir() + pathSep + path; cl.addEnvironment("PATH", path); //log.debug("PATH=" + path); String oooLibs = Environment.getOoSdkUreLibDir().getCanonicalPath(); if (SystemUtils.IS_OS_WINDOWS) { // I'm not sure if this works / is necessary cl.addEnvironment("DLLPATH", oooLibs); cl.addEnvironment("LIB", oooLibs); //log.debug("DLLPATH=" + oooLibs); } else if (SystemUtils.IS_OS_MAC) { cl.addEnvironment("DYLD_LIBRARY_PATH", oooLibs); //log.debug("DYLD_LIBRARY_PATH=" + oooLibs); } else { // *NIX environment cl.addEnvironment("LD_LIBRARY_PATH", oooLibs); //log.debug("LD_LIBRARY_PATH=" + oooLibs); } if (sJpdaAddress != null) { cl.addEnvironment("JAVA_TOOL_OPTIONS", "-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=" + sJpdaAddress); } if (sUserInstallation != null) { cl.addEnvironment("UserInstallation", "file://" + sUserInstallation.toURI().getRawPath()); } /*log.debug("Environment"); for (int i = 0; i < cl.getEnvironmentVariables().length; i++) { String string = cl.getEnvironmentVariables()[i]; log.debug(string); }*/ }
From source file:org.openoffice.maven.Environment.java
private static File guessOfficeHome() { File home = getenvAsFile(OFFICE_HOME); if (home != null) { return home; }/* w ww .ja va 2 s.c om*/ home = guessOfficeHomeFromPATH(); if (home != null) { return home; } if (SystemUtils.IS_OS_LINUX) { home = tryDirs("/opt/openoffice.org3", "/usr/lib/openoffice"); } else if (SystemUtils.IS_OS_MAC) { home = tryDirs("/Applications/OpenOffice.org.app", "/opt/ooo/OpenOffice.org.app"); } else if (SystemUtils.IS_OS_WINDOWS) { home = tryDirs("C:/programs/OpenOffice.org3", "C:/Programme/OpenOffice.org3", "C:/programs/OpenOffice.org 3", "C:/Programme/OpenOffice.org 3", "C:/Program Files (x86)/OpenOffice.org 3"); } else { home = tryDirs("/opt/openoffice.org3"); } if (home == null) { getLog().debug("office home not found - must be set via configuration '<ooo>...</ooo>'"); } return home; }
From source file:org.openoffice.maven.Environment.java
private static File guessOoSdkHome() { File home = getenvAsFile(OO_SDK_HOME); if (home != null) { return home; }//from ww w . j a va2 s . co m if (SystemUtils.IS_OS_LINUX) { home = tryDirs("/opt/openoffice.org/basis3.2/sdk", "/usr/lib/openoffice/basis3.2/sdk"); } else if (SystemUtils.IS_OS_MAC) { home = tryDirs("/Applications/OpenOffice.org3.2_SDK", "/opt/ooo/OpenOffice.org3.2_SDK"); } else if (SystemUtils.IS_OS_WINDOWS) { home = tryDirs(officeHome + "/Basis/sdk", "C:/Programme/OOsdk", "C:/sdk/OpenOffice.org_3.2_SDK/sdk", "C:/OO_SDK/sdk"); } else { home = FileFinder.tryDirs(new File(officeHome, "Basis/sdk"), new File("/opt/openoffice.org/basis3.2/sdk")); } if (home == null) { getLog().debug("SDK home not found - must be set via configuration '<sdk>...</sdk>'"); } return home; }
From source file:org.openoffice.maven.Environment.java
private static String getBaseDirName() { if (SystemUtils.IS_OS_MAC) { return "Contents/basis-link"; } else if (SystemUtils.IS_OS_WINDOWS) { return "Basis"; } else {//from w ww. java 2 s .co m return "basis-link"; } }
From source file:studio.ui.Studio.java
public void registerForMacOSXEvents() { if (registeredForMaxOSXEvents) return;/* w w w .ja va 2 s.c om*/ if (SystemUtils.IS_OS_MAC) try { // Generate and register the OSXAdapter, passing it a hash of all the methods we wish to // use as delegates for various com.apple.eawt.ApplicationListener methods OSXAdapter.setQuitHandler(new QuitHandler(this), QuitHandler.class.getDeclaredMethod("quit", (Class[]) null)); OSXAdapter.setAboutHandler(new AboutHandler(), AboutHandler.class.getDeclaredMethod("about", (Class[]) null)); registeredForMaxOSXEvents = true; } catch (Exception ex) { System.err.println("Error while loading the OSXAdapter:"); ex.printStackTrace(); } }
From source file:util.PosixComplianceUtil.java
private boolean isMostlyPosixCompliant() { return SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_UNIX; }