Permalink
Browse files

Fix force_encoding check on Ruby 1.8.

  • Loading branch information...
1 parent 2277d70 commit ef9435e0f053bfcd096831ea47ab9211a930cf59 @nex3 nex3 committed Sep 27, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/rb-inotify/notifier.rb
@@ -190,7 +190,8 @@ def watch(path, *flags, &callback)
return Watcher.new(self, path, *flags, &callback) unless flags.include?(:recursive)
Dir.glob(File.join(path, '*'), File::FNM_DOTMATCH).each do |d|
- next if d.dup.force_encoding('BINARY') =~ /\/\.\.?$/ # Current or parent directory
+ binary_d = d.respond_to?(:force_encoding) ? d.dup.force_encoding('BINARY') : d
+ next if binary_d =~ /\/\.\.?$/ # Current or parent directory
watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d)
end

0 comments on commit ef9435e

Please sign in to comment.