Sha256: 61b76408ac79f41edf6fcfb6709d84a8b0beb6c45ae2bf52d30026690e991adf
Contents?: true
Size: 1.25 KB
Versions: 71
Compression:
Stored size: 1.25 KB
Contents
#include <CoreServices/CoreServices.h> static void callback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]) { exit(0); } int main (int argc, const char * argv[]) { // Show help if (argc != 2 || strncmp(argv[1], "-h", 2) == 0) { printf("Sleep until a file in or below the watchdir is modified.\n"); printf("Usage: fsevent_sleep /path/to/watchdir\n"); exit(1); } // Create event stream CFStringRef pathToWatch = CFStringCreateWithCString(kCFAllocatorDefault, argv[1], kCFStringEncodingUTF8); CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&pathToWatch, 1, NULL); void *callbackInfo = NULL; FSEventStreamRef stream; CFAbsoluteTime latency = 1.0; stream = FSEventStreamCreate( kCFAllocatorDefault, callback, callbackInfo, pathsToWatch, kFSEventStreamEventIdSinceNow, latency, kFSEventStreamCreateFlagNone ); // Add stream to run loop FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); FSEventStreamStart(stream); CFRunLoopRun(); // Exit return 2; }
Version data entries
71 entries across 71 versions & 6 rubygems