cegredev / josi

A Java library designed to make making decisions based on the current operating system easier.
MIT License
36 stars 4 forks source link

Determine specific versions of Mac OS #2

Closed RohanNagar closed 3 years ago

RohanNagar commented 3 years ago

Hi! Really awesome library, I love how lightweight it is.

I wanted to contribute to adding specific versions of Mac OS.

From this doc, I found the os.version property. For Mac, this returns a string in the form 10.x.x. I matched that up to the version names from here.

Please let me know what you think!

cegredev commented 3 years ago

More Mac versions

RohanNagar commented 3 years ago

Hey @cegredev, thanks for the feedback. I just pushed an update to rename OS.MAC to OS.MAC_UNKNOWN.

As for your other questions:

Are you sure that the version number for Big Sur is 10.16 instead of 11 like shown in the Wikipedia article (l. 176, OS.java)?

I am running Big Sur (version 11.2.3) locally and I get 10.16 for os.version, as you can see:

Screen Shot 2021-04-23 at 8 13 37 AM

How can you confirm that the versions actually come in this format? If you just have one Mac machine and it's formatted like that, it's probably fair to assume the rest is as well, but it's important to me that you aren't just guessing. ;)

Yes, I have two Mac machines, one on Big Sur and one on Catalina. Big Sur returns 10.16 for the version, and Catalina returns 10.15.7.

Also, I found this old stack overflow post where os.version returned 10.7.4 on Lion.

Hope that helps!

dbwiddis commented 3 years ago

If you look at the JDK source code, it looks like they also will/do report 11.x versions. I'm sure for some time they also report 10.16 but you should handle both.

RohanNagar commented 3 years ago

@dbwiddis I opened #4 to address this.