forked from chromiumembedded/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOS.java
More file actions
44 lines (38 loc) · 1.22 KB
/
OS.java
File metadata and controls
44 lines (38 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef;
public class OS {
private static enum OSType {
OSUndefined,
OSLinux,
OSWindows,
OSMacintosh,
OSUnknown,
}
;
private static OSType osType = OSType.OSUndefined;
public static final boolean isWindows() {
return getOSType() == OSType.OSWindows;
}
public static final boolean isMacintosh() {
return getOSType() == OSType.OSMacintosh;
}
public static final boolean isLinux() {
return getOSType() == OSType.OSLinux;
}
private static final OSType getOSType() {
if (osType == OSType.OSUndefined) {
String os = System.getProperty("os.name").toLowerCase();
if (os.startsWith("windows"))
osType = OSType.OSWindows;
else if (os.startsWith("linux"))
osType = OSType.OSLinux;
else if (os.startsWith("mac"))
osType = OSType.OSMacintosh;
else
osType = OSType.OSUnknown;
}
return osType;
}
}