Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…le exists
  • Loading branch information...
commit 9daaab8381719188af6158acc13996235075df75 1 parent bcea233
authored

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  lib/filewatch/watch.rb
8  lib/filewatch/watch.rb
@@ -112,7 +112,13 @@ def subscribe(stat_interval = 1, discover_interval = 5, &block)
112 112
 
113 113
     private
114 114
     def _discover_file(path, initial=false)
115  
-      Dir.glob(path).each do |file|
  115
+      globbed_dirs = Dir.glob(path)
  116
+      @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs}")
  117
+      if globbed_dirs.empty? && File.file?(path)
  118
+        globbed_dirs = [path]
  119
+        @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs} because glob did not work")
  120
+      end
  121
+      globbed_dirs.each do |file|
116 122
         next if @files.member?(file)
117 123
         next unless File.file?(file)
118 124
 

2 notes on commit 9daaab8

Jordan Sissel

Want to send a pull request for this?

James Abley
Owner

This has been added to upstream under jordansissel#13

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