[Win32utils-devel] question about changejournal
stephen at exigencecorp.com
Wed Dec 21 02:10:38 EST 2005
I've got a newbie question--sorry if this is covered elsewhere, I parsed
through the archives for awhile and didn't see it.
I'd like to listen for whenever a file is renamed (e.g. foo.txt -> foo.old)
and then magically change it back. This sounds odd, but I'm working with a
stubborn application and this will actually make things work nice.
So, if I do:
cj = Win32::ChangeJournal.new('c:\\')
cj.wait do |array| ... end
Everything works great, except for:
a) info.file_name isn't the full path--is there a way to tell what directory
it is in? E.g. after getting the event, I'd like to go read in the file.
b) cj.wait returns after calling my block--I'd like my block to be called
for everything rename event, e.g. just sit there and keep listening. I
figure I could just do my processing and then call cj.wait again, but will I
miss renames while I'm doing my processing?
cj executes my block
My block starts
My block ends
I call cj.wait with my block as the param again
Will cj.wait "remember" that "Someone renames" happened while I was off
doing other processing and not blocking on it?
Also, if it seems like I'm abusing changejournal for something it shouldn't
be used for, please let me know.
More information about the win32utils-devel