From b83c1ade9bba9c972d0808740cc9325836b69ad6 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Thu, 30 Sep 2021 14:11:37 -0700 Subject: [PATCH] Fix in dmon.h for macOS path case sensitivity --- src/dmon.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dmon.h b/src/dmon.h index db39a6c1..fdbac3f4 100644 --- a/src/dmon.h +++ b/src/dmon.h @@ -1578,8 +1578,11 @@ _DMON_PRIVATE void dmon__fsevent_callback(ConstFSEventStreamRef stream_ref, void dmon__unixpath(abs_filepath, sizeof(abs_filepath), abs_filepath)); // strip the root dir - DMON_ASSERT(strstr(abs_filepath, watch->rootdir) == abs_filepath); - dmon__strcpy(ev.filepath, sizeof(ev.filepath), abs_filepath + strlen(watch->rootdir)); + size_t len = strlen(watch->rootdir); + // FIXME: filesystems on macOS can be case sensitive or not. The check below + // ignore case but we should check if the filesystem is case sensitive. + DMON_ASSERT(strncasecmp(abs_filepath, watch->rootdir, len) == 0); + dmon__strcpy(ev.filepath, sizeof(ev.filepath), abs_filepath + len); ev.event_flags = flags; ev.event_id = event_id;