diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2014-02-13 21:00:21 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2014-02-13 21:00:21 +0000 |
commit | 98dbb9126e1264f45ec637cb8570b3fbdf180258 (patch) | |
tree | 4d18828cf191f31bf2a30f9371933a694925434b /Foundation | |
parent | c6f01d86c37bd4e304fc26dd76cf007332ce4c10 (diff) |
Use compile-time checks where possible for determining system version.
DELTA=32 (32 added, 0 deleted, 0 changed)
Diffstat (limited to 'Foundation')
-rw-r--r-- | Foundation/GTMSystemVersion.m | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/Foundation/GTMSystemVersion.m b/Foundation/GTMSystemVersion.m index 2a84168..b234c2c 100644 --- a/Foundation/GTMSystemVersion.m +++ b/Foundation/GTMSystemVersion.m @@ -176,39 +176,71 @@ static NSString *const kSystemVersionPlistPath = @"/System/Library/CoreServices/ #if GTM_MACOS_SDK + (BOOL)isPanther { +#if defined(__MAC_10_4) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4 + return NO; +#else return sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor == 3; +#endif } + (BOOL)isTiger { +#if defined(__MAC_10_5) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5 + return NO; +#else return sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor == 4; +#endif } + (BOOL)isLeopard { +#if defined(__MAC_10_6) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 + return NO; +#else return sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor == 5; +#endif } + (BOOL)isSnowLeopard { +#if defined(__MAC_10_7) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7 + return NO; +#else return sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor == 6; +#endif } + (BOOL)isPantherOrGreater { - return (sGTMSystemVersionMajor > 10) || +#if defined(__MAC_10_3) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3 + return YES; +#else + return (sGTMSystemVersionMajor > 10) || (sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor >= 3); +#endif } + (BOOL)isTigerOrGreater { - return (sGTMSystemVersionMajor > 10) || +#if defined(__MAC_10_4) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4 + return YES; +#else + return (sGTMSystemVersionMajor > 10) || (sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor >= 4); +#endif } + (BOOL)isLeopardOrGreater { - return (sGTMSystemVersionMajor > 10) || +#if defined(__MAC_10_5) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5 + return YES; +#else + return (sGTMSystemVersionMajor > 10) || (sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor >= 5); +#endif } + (BOOL)isSnowLeopardOrGreater { - return (sGTMSystemVersionMajor > 10) || +#if defined(__MAC_10_6) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 + return YES; +#else + return (sGTMSystemVersionMajor > 10) || (sGTMSystemVersionMajor == 10 && sGTMSystemVersionMinor >= 6); +#endif } #endif // GTM_MACOS_SDK |