Description
A class for monitoring events related to files and directories. This
package is deprecated in favor of win32-changejournal on NTFS filesystems.
Prerequisites
* ffi
* win32-ipc
* win32-event
Installation
gem install win32-changenotify
Synopsis
require 'win32/changenotify'
include Win32
filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
path = 'C:\some\path'
cn = ChangeNotify.new(path, true, filter)
cn.wait{ |arr|
arr.each{ |info|
p info.file_name
p info.action
}
}
cn.close
ChangeNotify.new(path, true, filter) do |events|
events.each{ |event|
p event.file_name
p event.action
}
end
Notes
The Win32::ChangeNotify class is a subclass of Win32::Ipc, and thus has
all of its methods available as well.
This library is deprecated in favor of win32-changejournal on NTFS
filesystems.
Known Issues
Despite the improvements yielded as a result of using completion ports,
it's still possible that events could be missed. To be more precise,
any events that occur in the fraction of a second between the call to
GetQueuedCompletionStatus() and ReadDirectoryChangesW() in the wait loop
will not get picked up. As a general rule, the faster your system is,
the less likely you are to encounter this scenario.
With Ruby 2.x and JRuby this should be even less of an issue than it's
been in the past.
Acknowledgements
This class was originally based on the Win32::ChangeNotify Perl module by
Christopher Madsen.
Future Plans
Probably none. This library is deprecated in favor of win32-changejournal.
However, that library only works on NTFS filesystems, so this library will
be maintained as well.
That being said, I'm always open to improvements, so feel free to submit
ideas and patches.
Known Bugs
None that I know of. Please report any issues on the project page at:
http://www.github.com/djberg96/win32-changenotify
License
Artistic 2.0
Copyright
(C) 2003-2013 Daniel J. Berger, All Rights Reserved
Warranty
This package is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantability and fitness for a particular purpose.
Authors
Park Heesob
Daniel J. Berger