Skip to content

Commit e215337

Browse files
committed
enum for os type
1 parent 07ef572 commit e215337

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
package com.microsoft.aad.msal4j;
22

33
public 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
}

0 commit comments

Comments
 (0)