Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ edition = "2018"

[dependencies]
bitflags = "1"
fsevent-sys = "4.0.0"
# fsevent-sys = { path = "fsevent-sys" }
# fsevent-sys = "5.0.0"
fsevent-sys = { path = "fsevent-sys" }
core-foundation = "0.9.4"

[dev-dependencies]
tempfile = "3"
Expand Down
11 changes: 4 additions & 7 deletions examples/fsevent-async-demo.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
extern crate fsevent;
use std::{sync::mpsc::channel, thread};

use std::sync::mpsc::channel;
use std::thread;

#[cfg(not(target_os="macos"))]
#[cfg(not(target_os = "macos"))]
fn main() {}

#[cfg(target_os="macos")]
#[cfg(target_os = "macos")]
fn main() {
let (sender, receiver) = channel();

Expand All @@ -24,7 +21,7 @@ fn main() {
Err(e) => match e {
std::sync::mpsc::RecvTimeoutError::Disconnected => break,
_ => {} // This is the case where nothing entered the channel buffer (no file mods).
}
},
}
}

Expand Down
8 changes: 3 additions & 5 deletions examples/fsevent-demo.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
extern crate fsevent;
use std::sync::mpsc::channel;
use std::thread;
use std::{sync::mpsc::channel, thread};

#[cfg(not(target_os="macos"))]
#[cfg(not(target_os = "macos"))]
fn main() {}

#[cfg(target_os="macos")]
#[cfg(target_os = "macos")]
fn main() {
let (sender, receiver) = channel();

Expand Down
10 changes: 7 additions & 3 deletions fsevent-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
[package]
name = "fsevent-sys"
version = "4.1.0"
version = "5.0.0"
authors = ["Pierre Baillet <pierre@baillet.name>"]
description = "Rust bindings to the fsevent macOS API for file changes notifications"
license = "MIT"
repository = "https://github.com/octplane/fsevent-rust/tree/master/fsevent-sys"
edition = "2018"

[dependencies]
libc = "0.2.68"
dispatch2 = { version = "0.2.0", default-features = false, features = ["alloc"] }
core-foundation = "0.9.2"

[package.metadata.docs.rs]
targets = ["x86_64-apple-darwin"]
targets = [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
]
230 changes: 0 additions & 230 deletions fsevent-sys/src/core_foundation.rs

This file was deleted.

25 changes: 17 additions & 8 deletions fsevent-sys/src/fsevent.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#![allow(non_upper_case_globals, non_camel_case_types)]

use crate::core_foundation::{
Boolean, CFAbsoluteTime, CFAllocatorCopyDescriptionCallBack, CFAllocatorRef,
CFAllocatorReleaseCallBack, CFAllocatorRetainCallBack, CFArrayRef, CFIndex, CFRunLoopRef,
CFStringRef, CFTimeInterval,
use core_foundation::{
array::{CFArrayRef, CFIndex},
base::{
Boolean, CFAllocatorCopyDescriptionCallBack, CFAllocatorReleaseCallBack,
CFAllocatorRetainCallBack,
},
date::{CFAbsoluteTime, CFTimeInterval},
mach_port::CFAllocatorRef,
runloop::CFRunLoopRef,
string::CFStringRef,
};
use dispatch2::ffi::dispatch_queue_t;
use std::os::{
raw::{c_uint, c_void},
unix::raw::dev_t,
};
use libc::dev_t;
use std::os::raw::{c_uint, c_void};

pub type FSEventStreamRef = *mut c_void;
pub type ConstFSEventStreamRef = *const c_void;
Expand Down Expand Up @@ -74,7 +83,7 @@ pub struct FSEventStreamContext {

// https://developer.apple.com/documentation/coreservices/file_system_events
#[link(name = "CoreServices", kind = "framework")]
extern "C" {
unsafe extern "C" {
pub fn FSEventStreamCopyDescription(stream_ref: ConstFSEventStreamRef) -> CFStringRef;
pub fn FSEventStreamCopyPathsBeingWatched(streamRef: ConstFSEventStreamRef) -> CFArrayRef;
pub fn FSEventStreamCreate(
Expand Down Expand Up @@ -109,7 +118,7 @@ extern "C" {
run_loop: CFRunLoopRef,
run_loop_mode: CFStringRef,
);
// pub fn FSEventStreamSetDispatchQueue(streamRef: FSEventStreamRef, q: DispatchQueue);
pub fn FSEventStreamSetDispatchQueue(stream_ref: FSEventStreamRef, q: dispatch_queue_t);
pub fn FSEventStreamSetExclusionPaths(
stream_ref: FSEventStreamRef,
paths_to_exclude: CFArrayRef,
Expand Down
3 changes: 0 additions & 3 deletions fsevent-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#![cfg(target_os = "macos")]
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]

pub mod core_foundation;
mod fsevent;

pub use fsevent::*;
Loading