Skip to content

Commit

Permalink
Support non-UTF-8 filenames, even when the default external encoding …
Browse files Browse the repository at this point in the history
…is UTF-8.

I'm pretty tempted to just say "set your default encodings properly", but since
we aren't actually doing anything that requires knowledge of the encoding of the
string, we might as well work around the issue.

You should still set your default encodings properly, though.
  • Loading branch information
nex3 committed Sep 27, 2011
1 parent f7879c5 commit f9d85d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rb-inotify/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ 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 =~ /\/\.\.?$/ # Current or parent directory
next if d.dup.force_encoding('BINARY') =~ /\/\.\.?$/ # Current or parent directory
watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d)
end

Expand Down

0 comments on commit f9d85d9

Please sign in to comment.