Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for ocassions when Dir.glob returns an empty file, even if the fi…

…le exists
  • Loading branch information...
commit 9daaab8381719188af6158acc13996235075df75 1 parent bcea233
shodhan sheth authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/filewatch/watch.rb
View
8 lib/filewatch/watch.rb
@@ -112,7 +112,13 @@ def subscribe(stat_interval = 1, discover_interval = 5, &block)
private
def _discover_file(path, initial=false)
- Dir.glob(path).each do |file|
+ globbed_dirs = Dir.glob(path)
+ @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs}")
+ if globbed_dirs.empty? && File.file?(path)
+ globbed_dirs = [path]
+ @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs} because glob did not work")
+ end
+ globbed_dirs.each do |file|
next if @files.member?(file)
next unless File.file?(file)

2 comments on commit 9daaab8

@jordansissel

Want to send a pull request for this?

@jabley
Owner

This has been added to upstream under jordansissel#13

Please sign in to comment.
Something went wrong with that request. Please try again.