File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
msal4j-sdk/src/main/java/com/microsoft/aad/msal4j Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change 1
1
package com .microsoft .aad .msal4j ;
2
2
3
3
public class OSHelper {
4
+ enum OSType {
5
+ MAC ,
6
+ WINDOWS ,
7
+ LINUX
8
+ }
4
9
5
- private static String os ;
6
- private static boolean mac ;
7
- private static boolean windows ;
8
- private static boolean linux ;
10
+ private static final String OS ;
11
+ private static OSType osType ;
9
12
10
13
static {
11
- os = System .getProperty ("os.name" ).toLowerCase ();
12
- if (os .contains ("windows" )){
13
- windows = true ;
14
- }else if (os .contains ("mac" )){
15
- mac = true ;
16
- }else if (os .contains ("nux" ) || os .contains ("nix" )){
17
- linux = true ;
14
+ OS = System .getProperty ("os.name" ).toLowerCase ();
15
+ if (OS .contains ("windows" )){
16
+ osType = OSType . WINDOWS ;
17
+ }else if (OS .contains ("mac" )){
18
+ osType = OSType . MAC ;
19
+ }else if (OS .contains ("nux" ) || OS .contains ("nix" )){
20
+ osType = OSType . LINUX ;
18
21
}
19
22
}
20
23
21
24
public static String getOs (){
22
- return os ;
25
+ return OS ;
23
26
}
24
27
25
28
public static boolean isMac (){
26
- return mac ;
29
+ return OSType . MAC . equals ( osType ) ;
27
30
}
28
31
29
32
public static boolean isWindows (){
30
- return windows ;
33
+ return OSType . WINDOWS . equals ( osType ) ;
31
34
}
32
35
33
36
public static boolean isLinux (){
34
- return linux ;
37
+ return OSType . LINUX . equals ( osType ) ;
35
38
}
36
-
37
-
38
39
}
You can’t perform that action at this time.
0 commit comments