From 98dbb9126e1264f45ec637cb8570b3fbdf180258 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Thu, 13 Feb 2014 21:00:21 +0000 Subject: Use compile-time checks where possible for determining system version. DELTA=32 (32 added, 0 deleted, 0 changed) --- Foundation/GTMSystemVersion.m | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'Foundation') 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 -- cgit v1.2.3