32
33 private static final String osName = System.getProperty("os.name");
34
35 /**
36 * Checking whether the platform is linux
37 * @return
38 */
39 public static boolean isLinux() {
40 return isOs("linux");
41 }
42
43 /**
44 * Checking whether the platform is OSX
45 * @return
46 */
47 public static boolean isOSX() {
48 return isOs("mac");
49 }
50
51 /**
52 * Checking whether the platform is Solaris
53 * @return
54 */
55 public static boolean isSolaris() {
56 return isOs("sunos");
57 }
58
59 /**
60 * Checking whether the platform is Windows
61 * @return
62 */
63 public static boolean isWindows() {
64 return isOs("win");
65 }
66
67 private static boolean isOs(String osname) {
68 return osName.toLowerCase().startsWith(osname.toLowerCase());
69 }
70 }
|
32
33 private static final String osName = System.getProperty("os.name");
34
35 /**
36 * Checking whether the platform is linux
37 * @return
38 */
39 public static boolean isLinux() {
40 return isOs("linux");
41 }
42
43 /**
44 * Checking whether the platform is OSX
45 * @return
46 */
47 public static boolean isOSX() {
48 return isOs("mac");
49 }
50
51 /**
52 * Checking whether the platform is Windows
53 * @return
54 */
55 public static boolean isWindows() {
56 return isOs("win");
57 }
58
59 private static boolean isOs(String osname) {
60 return osName.toLowerCase().startsWith(osname.toLowerCase());
61 }
62 }
|