File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
src/main/java/com/nativejavafx/taskbar/util Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 66 * application runs on.
77 */
88public class OS {
9+
10+ private static final String OS = System .getProperty ("os.name" );
11+ private static final String VERSION = System .getProperty ("os.version" );
12+
13+ private static final boolean WINDOWS = OS .startsWith ("Windows" );
14+ private static final boolean WINDOWS_7_OR_LATER = WINDOWS && versionGreaterThanOrEqualTo (6.1F );
15+
916 private OS () {
1017 }
1118
@@ -16,19 +23,14 @@ private OS() {
1623 * <code>false</code> otherwise
1724 */
1825 public static boolean isWindows7OrLater () {
19- double version = Double .parseDouble (System .getProperty ("os.version" ));
20- double win7Version = 6.1 ; //Windows 7 has this version number
21-
22- return isWindows () && version >= win7Version ;
26+ return WINDOWS_7_OR_LATER ;
2327 }
2428
25- /**
26- * Checks that the OS is windows or not.
27- *
28- * @return <code>true</code> if the OS is windows;
29- * <code>false</code> otherwise
30- */
31- public static boolean isWindows () {
32- return System .getProperty ("os.name" ).startsWith ("Windows" );
29+ public static boolean versionGreaterThanOrEqualTo (float value ) {
30+ try {
31+ return Float .parseFloat (VERSION ) >= value ;
32+ } catch (Exception e ) {
33+ return false ;
34+ }
3335 }
3436}
You can’t perform that action at this time.
0 commit comments