Comment detail
ファイル更新の監視 (Nested Flatten)
mtime を見ないで済むよう書き換えました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | require 'rubygems'
require 'win32/ipc' # http://rubyforge.org/projects/win32utils
require 'win32/changenotify' # http://rubyforge.org/projects/win32utils
include Win32
exit if ARGV == []
filename = File.expand_path(ARGV[0])
flags = ChangeNotify::FILE_NAME | ChangeNotify::LAST_WRITE | ChangeNotify::SIZE
cn = ChangeNotify.new(File.dirname(filename), false, flags)
loop {
cn.wait(){|sa|
sa.each {|st|
puts "modified!" if st.file_name == File.basename(filename)
}
}
}
|



kawauchi #391() [ Ruby ] Rating1/1=1.00
Rating1/1=1.00-0+
1 reply [ reply ]