[ANN] win32-changenotify 0.3.0

D

Daniel Berger

Hi all,

The Win32Utils Team is proud to annouce win32-changenotify 0.3.0

What is it?
===========
An interface for monitoring file and/or directory changes on the Win32
platform.

Synopsis
========
require "win32/changenotify"
include Win32

# Wait for any writes to files in the C:\ drive.
filter = ChangeNotify::LAST_WRITE
cn = ChangeNotify.new("C:\\",true,filter)
cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action
}

What's new?
===========
The interface has been altered so that ChangeNotify#wait will yield a
structure (if a block is given) that provides more detailed information
as to what, exactly, the changes were.

See the documentation for more details.

Where is it?
============
You can find it on the RAA or on the RubyForge project page at
http://www.rubyforge.org/projects/win32utils.

Also, I have release a standalone .so file that you can download from
the RubyForge project page if you don't happen to have a compiler. Be
sure to put it under a "win32" toplevel directory somewhere in your
library path.

Many thanks go to Park Heesob (again) for helping me with some sticky C
issues.

Future Plans
============
We are planning on an interface for Change Journals which will either
supplant or replace this package. Keep an eye out. :)
Enjoy!

The Win32Utils Team
 
C

CT

Thanks for the great work with win32!


require "win32/changenotify"
include Win32

# Wait for any writes to files in the C:\ drive.
filter = ChangeNotify::LAST_WRITE
cn = ChangeNotify.new("C:\\",true,filter)
cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action
}

I tried to run this script, after installing everything. The script
terminates, I make changes to files in C:\\, and nothing happens. What
am I doing wrong? Is there any other doc/sample for
win32-changenotify?

Thanks in advance!
CT
 
C

CT

require "win32/changenotify"
Okay, I got this working, kinda, after mucking around a bit. What I
want is a daemon-like thingie which will give me notifications when
stuff inside a partocular directory changes. Is it advisable to wrap
the cn.wait call inside an infinite loop, for this? Are there any
consequences for that?
I did something like this:

while true
cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action
}
end

This does detect file changes, but I donot understand how I get away
without calling cn.reset. Is that invoked when the block is called?

Thanks!
CT
 
D

Daniel Berger

CT said:
Okay, I got this working, kinda, after mucking around a bit. What I
want is a daemon-like thingie which will give me notifications when
stuff inside a partocular directory changes. Is it advisable to wrap
the cn.wait call inside an infinite loop, for this? Are there any
consequences for that?
I did something like this:

while true
cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action
}
end

This does detect file changes, but I donot understand how I get away
without calling cn.reset. Is that invoked when the block is called?

Thanks!
CT

Hi CT,

Whoops, this did show up on Google Groups after all. Ugh - still
getting used to the new interface.

Anyway, you inadvertantly discovered a bug, which I have fixed and
uploaded to RubyForge. Please download win32-changenotify 0.3.1 and
try again. You should *not* have to wrap the cn.wait call in a "while
true" block. It should wait indefinitely if no timeout is specified.

Thanks much!

Regards,

PS - Park is working on win32-changejournal as we speak, which will
probably supplant the win32-changenotify package.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top