Skip to content

Commit

Permalink
Remove support for old Go versions
Browse files Browse the repository at this point in the history
Fixes #51
  • Loading branch information
arp242 committed Oct 14, 2022
1 parent 3899270 commit ba99ec5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 81 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
go 1.16

module github.com/fsnotify/fsevents
28 changes: 0 additions & 28 deletions go_1_10_after.go

This file was deleted.

26 changes: 0 additions & 26 deletions go_1_10_before.go

This file was deleted.

12 changes: 0 additions & 12 deletions go_1_9_2_after.go

This file was deleted.

14 changes: 0 additions & 14 deletions go_1_9_2_before.go

This file was deleted.

19 changes: 18 additions & 1 deletion wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const (
FileEvents = CreateFlags(C.kFSEventStreamCreateFlagFileEvents)
)


// EventFlags passed to the FSEventStreamCallback function.
// These correspond directly to the flags as described here:
// https://developer.apple.com/documentation/coreservices/1455361-fseventstreameventflags
Expand Down Expand Up @@ -227,6 +226,24 @@ const (
ItemIsSymlink = EventFlags(C.kFSEventStreamEventFlagItemIsSymlink)
)

const (
nullCFStringRef = C.CFStringRef(0)
nullCFUUIDRef = C.CFUUIDRef(0)

// eventIDSinceNow is a sentinel to begin watching events "since now".
eventIDSinceNow = uint64(C.kFSEventStreamEventIdSinceNow)
)

// GetDeviceUUID retrieves the UUID required to identify an EventID
// in the FSEvents database
func GetDeviceUUID(deviceID int32) string {
uuid := C.FSEventsCopyUUIDForDevice(C.dev_t(deviceID))
if uuid == nullCFUUIDRef {
return ""
}
return cfStringToGoString(C.CFUUIDCreateString(C.kCFAllocatorDefault, uuid))
}

// LatestEventID returns the most recently generated event ID, system-wide.
func LatestEventID() uint64 {
return uint64(C.FSEventsGetCurrentEventId())
Expand Down

0 comments on commit ba99ec5

Please sign in to comment.