001
014
015 package com.liferay.portal.kernel.util;
016
017 import java.io.File;
018
019
022 public class OSDetector {
023
024 public static boolean isAIX() {
025 if (_aix == null) {
026 String osName = System.getProperty("os.name").toLowerCase();
027
028 if (osName.equals("aix")) {
029 _aix = Boolean.TRUE;
030 }
031 else {
032 _aix = Boolean.FALSE;
033 }
034 }
035
036 return _aix.booleanValue();
037 }
038
039 public static boolean isApple() {
040 if (_apple == null) {
041 String osName = System.getProperty("os.name").toLowerCase();
042
043 if (osName.contains("mac")) {
044 _apple = Boolean.TRUE;
045 }
046 else {
047 _apple = Boolean.FALSE;
048 }
049 }
050
051 return _apple.booleanValue();
052 }
053
054 public static boolean isUnix() {
055 if (_unix == null) {
056 if (File.pathSeparator.equals(StringPool.COLON)) {
057 _unix = Boolean.TRUE;
058 }
059 else {
060 _unix = Boolean.FALSE;
061 }
062 }
063
064 return _unix.booleanValue();
065 }
066
067 public static boolean isWindows() {
068 if (_windows == null) {
069 if (File.pathSeparator.equals(StringPool.SEMICOLON)) {
070 _windows = Boolean.TRUE;
071 }
072 else {
073 _windows = Boolean.FALSE;
074 }
075 }
076
077 return _windows.booleanValue();
078 }
079
080 private static Boolean _aix;
081 private static Boolean _apple;
082 private static Boolean _unix;
083 private static Boolean _windows;
084
085 }