283b622013-03-26Martin Nilsson #pike __REAL_VERSION__
e1fb092014-02-14Martin Nilsson #require constant(System._FSEvents)
283b622013-03-26Martin Nilsson  //! The @[System.FSEvents] module provides an interface to FSEvents.
3524712015-05-26Martin Nilsson //! FSEvents is an API in Mac OS X which allows an application to register //! for notifications of changes to a given directory tree without forcing
3f61eb2014-02-28Bill Welliver //! the application to continously poll the directory tree.
3524712015-05-26Martin Nilsson //! //! This module is designed for use in asynchronous, or backend mode. That //! is, rather than polling for changes, a function you specify will be //! called when events of interest occur.
3f61eb2014-02-28Bill Welliver //! //! @note
3524712015-05-26Martin Nilsson //! This module requires the presence and use of a CFRunLoop based Backend //! object, otherwise this module will not receive events from the OS.
3f61eb2014-02-28Bill Welliver //! CFRunLoop based backends are avilable on Mac OS X 10.5 and higher. //! //! @seealso //! @[Pike.PollDeviceBackend.enable_core_foundation]
762a142012-06-29Bill Welliver inherit System._FSEvents; //! describe the event flags associated with an event. //! //! @returns //! a string describing the flags set. string describe_event_flag(int mask) { array(string) list = ({});
3524712015-05-26Martin Nilsson 
762a142012-06-29Bill Welliver  foreach (indices(this_program);; string name) { if (has_prefix(name, "kFSEventStreamEventFlag")) { int value = `[](this_program, name); if (value & mask) list += ({ name }); } } return list * "|"; }