Daniel Berger
2006-Dec-21 02:38 UTC
[Win32utils-devel] Curious win32-changenotify behavior - numbers instead of names
Hi all,
Ruby 1.8.5
win32-ipc 0.4.2 (or 0.5.0 in cvs)
win32-changenotify 0.4.2
I noticed something strange tonight while tinkering with
win32-changenotify. Here''s my sample script:
# cntest.rb
require ''win32/changenotify''
include Win32
path = "C:\\test"
filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME
cn = ChangeNotify.new(path, true, filter)
cn.wait{ |arr|
arr.each{ |e|
p e
}
} while true
cn.close
I then created a file called "test.txt" with gvim, and occasionally
did
":w" to save it. The weird thing is that sometimes I get the actual
file name, and sometimes I get a strange number. Any idea what''s
causing it?
#<struct Struct::ChangeNotifyStruct action="added",
file_name="test.txt">
#<struct Struct::ChangeNotifyStruct action="added",
file_name="4913">
#<struct Struct::ChangeNotifyStruct action="added",
file_name="4913">
#<struct Struct::ChangeNotifyStruct action="added",
file_name="4913">
#<struct Struct::ChangeNotifyStruct action="removed",
file_name=".test.txt.swo">
Any ideas?
- Dan
