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 11package com .microsoft .aad .msal4j ;
22
33public class OSHelper {
4+ enum OSType {
5+ MAC ,
6+ WINDOWS ,
7+ LINUX
8+ }
49
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 ;
912
1013 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 ;
1821 }
1922 }
2023
2124 public static String getOs (){
22- return os ;
25+ return OS ;
2326 }
2427
2528 public static boolean isMac (){
26- return mac ;
29+ return OSType . MAC . equals ( osType ) ;
2730 }
2831
2932 public static boolean isWindows (){
30- return windows ;
33+ return OSType . WINDOWS . equals ( osType ) ;
3134 }
3235
3336 public static boolean isLinux (){
34- return linux ;
37+ return OSType . LINUX . equals ( osType ) ;
3538 }
36-
37-
3839}
You can’t perform that action at this time.
0 commit comments