From 1d7cb5d8039ac24458a7a73a9c8fef9c8edbaf0d Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 14 Dec 2020 10:41:11 +0000 Subject: [PATCH] [mac] Add compatibility with old macOS versions (#733) * Add compatibility with old macOS versions * Define symbols only for older versions And not for older or equal, since the equal version is when the symbol was introduced. * Ensure version macros are available * Update changelog --- changelog.rst | 3 ++- src/watchdog_fsevents.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/changelog.rst b/changelog.rst index 1f21910b..f052c9de 100644 --- a/changelog.rst +++ b/changelog.rst @@ -9,7 +9,8 @@ Changelog 202x-xx-xx • `full history `__ - [mac] Fix missing ``event_id`` attribute in ``fsevents`` (`#721 `_) -- Thanks to our beloved contributors: @SamSchott +- [mac] Add compatibility with old macOS versions (`#733` `_) +- Thanks to our beloved contributors: @SamSchott, @CCP-Aporia 1.0.1 diff --git a/src/watchdog_fsevents.c b/src/watchdog_fsevents.c index a8e8b989..5314ff8c 100644 --- a/src/watchdog_fsevents.c +++ b/src/watchdog_fsevents.c @@ -20,12 +20,38 @@ #include +#include #include #include #include #include +/* Compatibility; since fsevents won't set these on earlier macOS versions the properties will always be False */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 +#error Watchdog module requires at least Mac OS X 10.7 +#endif +#ifndef MAC_OS_X_VERSION_10_9 +#define MAC_OS_X_VERSION_10_9 1090 +#endif +#ifndef MAC_OS_X_VERSION_10_10 +#define MAC_OS_X_VERSION_10_10 101000 +#endif +#ifndef MAC_OS_X_VERSION_10_13 +#define MAC_OS_X_VERSION_10_13 101300 +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9 +#define kFSEventStreamEventFlagOwnEvent 0x00080000 +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10 +#define kFSEventStreamEventFlagItemIsHardlink 0x00100000 +#define kFSEventStreamEventFlagItemIsLastHardlink 0x00200000 +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 +#define kFSEventStreamEventFlagItemCloned 0x00400000 +#endif + + /* Convenience macros to make code more readable. */ #define G_NOT(o) !o #define G_IS_NULL(o) o == NULL