38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/spring/watcher/abstract.rb', line 38
def add(*items)
debug { "watcher: add: #{items.inspect}" }
items = items.flatten.map do |item|
item = Pathname.new(item)
if item.relative?
Pathname.new("#{root}/#{item}")
else
item
end
end
items = items.select do |item|
if item.symlink?
item.readlink.exist?.tap do |exists|
if !exists
debug { "add: ignoring dangling symlink: #{item.inspect} -> #{item.readlink.inspect}" }
end
end
else
item.exist?
end
end
@mutex.synchronize do
items.each do |item|
if item.directory?
directories[item.realpath.to_s] = true
else
begin
files[item.realpath.to_s] = true
rescue Errno::ENOENT
debug { "add: ignoring now-dangling symlink: #{item.inspect} -> #{item.readlink.inspect}" }
end
end
end
subjects_changed
end
end
|