1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

Added OperatingSystemType::MacOSX for checking whether any version of OSX is running, and also Windows 10 detection.

This commit is contained in:
jules 2015-04-27 12:36:29 +01:00
parent c17a72e5b1
commit 19b2beec63
2 changed files with 30 additions and 22 deletions

View file

@ -131,7 +131,12 @@ static bool isWindowsVersionOrLater (SystemStats::OperatingSystemType target)
zerostruct (info);
info.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (target >= SystemStats::WinVista)
if (target >= SystemStats::Windows10)
{
info.dwMajorVersion = 10;
info.dwMinorVersion = 0;
}
else if (target >= SystemStats::WinVista)
{
info.dwMajorVersion = 6;
@ -166,7 +171,7 @@ static bool isWindowsVersionOrLater (SystemStats::OperatingSystemType target)
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
{
const SystemStats::OperatingSystemType types[]
= { Windows8_1, Windows8_0, Windows7, WinVista, WinXP, Win2000 };
= { Windows10, Windows8_1, Windows8_0, Windows7, WinVista, WinXP, Win2000 };
for (int i = 0; i < numElementsInArray (types); ++i)
if (isWindowsVersionOrLater (types[i]))
@ -182,6 +187,7 @@ String SystemStats::getOperatingSystemName()
switch (getOperatingSystemType())
{
case Windows10: name = "Windows 10"; break;
case Windows8_1: name = "Windows 8.1"; break;
case Windows8_0: name = "Windows 8.0"; break;
case Windows7: name = "Windows 7"; break;

View file

@ -47,29 +47,31 @@ public:
/** The set of possible results of the getOperatingSystemType() method. */
enum OperatingSystemType
{
UnknownOS = 0,
UnknownOS = 0,
Linux = 0x2000,
Android = 0x3000,
iOS = 0x8000,
MacOSX = 0x0100, /**< To test whether any version of OSX is running,
you can use the expression ((getOperatingSystemType() & MacOSX) != 0). */
Windows = 0x0200, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
Linux = 0x0400,
Android = 0x0800,
iOS = 0x1000,
MacOSX_10_4 = 0x1004,
MacOSX_10_5 = 0x1005,
MacOSX_10_6 = 0x1006,
MacOSX_10_7 = 0x1007,
MacOSX_10_8 = 0x1008,
MacOSX_10_9 = 0x1009,
MacOSX_10_10 = 0x100a,
MacOSX_10_4 = MacOSX | 4,
MacOSX_10_5 = MacOSX | 5,
MacOSX_10_6 = MacOSX | 6,
MacOSX_10_7 = MacOSX | 7,
MacOSX_10_8 = MacOSX | 8,
MacOSX_10_9 = MacOSX | 9,
MacOSX_10_10 = MacOSX | 10,
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,
Windows8_0 = 0x4109,
Windows8_1 = 0x410a,
Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
Win2000 = Windows | 1,
WinXP = Windows | 2,
WinVista = Windows | 3,
Windows7 = Windows | 4,
Windows8_0 = Windows | 5,
Windows8_1 = Windows | 6,
Windows10 = Windows | 7
};
/** Returns the type of operating system we're running on.