def initialize(*params, &block)
raise ArgumentError, 'No callback block was specified.' unless block_given?
options = params.last.kind_of?(Hash) ? params.pop : {}
@paths = params.flatten
paths.each { |path| raise ArgumentError, "The specified path (#{path}) does not exist." unless File.exist?(path) }
@allocator = options[:allocator] || OSX::KCFAllocatorDefault
@context = options[:context] || nil
@since = options[:since] || OSX::KFSEventStreamEventIdSinceNow
@latency = options[:latency] || 0.0
@flags = options[:flags] || 0
@stream = options[:stream] || nil
@user_callback = block
@callback = Proc.new do |stream, client_callback_info, number_of_events, paths_pointer, event_flags, event_ids|
paths_pointer.regard_as('*')
events = []
number_of_events.times { |i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) }
@user_callback.call(events)
end
end