nex3/rb-inotify — pull request #22 by geoffyoungs (2012-12-05 18:33:45+00:00)
Title: Update lib/rb-inotify/notifier.rb

I ran into a problem caused by an oddly named directory which resulted in the inotify backend for guard reliably crashing out on a rails project.

The follow snippet demonstrates the issue:

```` ruby
require 'rb-inotify'
require 'fileutils'

FileUtils.mkdir_p("test-1/**")

listener = INotify::Notifier.new
listener.watch("test-1", :all_events, :recursive) do |event|
p event
end
````

When it encounters a directory named '**', the current code (using Dir.glob) enters an infinite, recursive loop until it throws a SystemStackError, because the directory name is a self-matching glob pattern.

As the code in #watch is only using Dir.glob as a convenient way to get a path, rather than just a list of leafnames, I figure the best solution is to switch to Dir.new?