N
nkb
Hi.
I placed the following codes at the bottom of the file DirectoryWatch.rb
and ran it from my command line in WindowsXp. Nothing seems to be
happening even when I change/add/modify files. What am I missing? Thanks.
device_manager = Dir:irectoryWatcher.new( 'c:/temp', 2 )
device_manager.name_regexp = /^[^.].*\.rb$/
device_manager.on_add = Proc.new{ |the_file, stats_hash|
puts "Hey, just found #{the_file.inspect}!"
# Store something custom
stats_hash[:blorgle] = the_file.foo
}
device_manager.on_modify = Proc.new{ |the_file, stats_hash|
puts "Hey, #{the_file.inspect} just changed."
}
device_manager.on_remove = Proc.new{ |stats_hash|
puts "Whoa, the following file just disappeared:"
stats_hash.each_pair{ |k,v|
puts "#{k} : #{v}"
}
}
device_manager.start_watching()
I placed the following codes at the bottom of the file DirectoryWatch.rb
and ran it from my command line in WindowsXp. Nothing seems to be
happening even when I change/add/modify files. What am I missing? Thanks.
device_manager = Dir:irectoryWatcher.new( 'c:/temp', 2 )
device_manager.name_regexp = /^[^.].*\.rb$/
device_manager.on_add = Proc.new{ |the_file, stats_hash|
puts "Hey, just found #{the_file.inspect}!"
# Store something custom
stats_hash[:blorgle] = the_file.foo
}
device_manager.on_modify = Proc.new{ |the_file, stats_hash|
puts "Hey, #{the_file.inspect} just changed."
}
device_manager.on_remove = Proc.new{ |stats_hash|
puts "Whoa, the following file just disappeared:"
stats_hash.each_pair{ |k,v|
puts "#{k} : #{v}"
}
}
device_manager.start_watching()