Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-enable dune on older macos sdk's #6515

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/fsevents/fsevents_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#include <caml/threads.h>

#if defined(__APPLE__)
#include <AvailabilityMacros.h>
#endif

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

#include <Availability.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>

Expand Down Expand Up @@ -90,9 +93,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 =
rgrinberg marked this conversation as resolved.
Show resolved Hide resolved
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 +335,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