Skip to content

Commit

Permalink
fix: re-enable dune on older macos sdk's
Browse files Browse the repository at this point in the history
by disabling watch mode on such versions

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: dc8e96cc-61a9-4497-baac-0934b82efe6f
  • Loading branch information
rgrinberg committed Nov 19, 2022
1 parent 18ccfea commit 28a929d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/fsevents/fsevents_stubs.c
Expand Up @@ -6,7 +6,7 @@
#include <caml/mlvalues.h>
#include <caml/threads.h>

#if defined(__APPLE__)
#if defined(__APPLE__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 100700

#include <Availability.h>
#include <CoreFoundation/CoreFoundation.h>
Expand Down Expand Up @@ -90,9 +90,10 @@ static void dune_fsevents_callback(const FSEventStreamRef streamRef,
CFStringRef cf_path;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
CFDictionaryRef details = CFArrayGetValueAtIndex(eventPaths, i);
cf_path = CFDictionaryGetValue(details, kFSEventStreamEventExtendedDataPathKey);
cf_path =
CFDictionaryGetValue(details, kFSEventStreamEventExtendedDataPathKey);
#else
cf_path = (CFStringRef) CFArrayGetValueAtIndex(eventPaths, i);
cf_path = (CFStringRef)CFArrayGetValueAtIndex(eventPaths, i);
#endif
CFIndex len = CFStringGetLength(cf_path);
CFIndex byte_len;
Expand Down Expand Up @@ -331,7 +332,12 @@ CAMLprim value dune_fsevents_available(value unit) {

#else

static char *unavailable_message = "fsevents is only available on macos";
static char *unavailable_message =
#if defined(__APPLE__)
"upgrade your macos sdk to enable watch mode";
#else
"fsevents is only available on macos";
#endif

CAMLprim value dune_fsevents_stop(value v_t) {
caml_failwith(unavailable_message);
Expand Down

0 comments on commit 28a929d

Please sign in to comment.