20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
|
# File 'lib/command-t/scanner/file_scanner/watchman_file_scanner.rb', line 20
def paths!
sockname = (
Watchman::Utils.load(get_raw_sockname),
'sockname'
)
UNIXSocket.open(sockname) do |socket|
root = Pathname.new(@path).realpath.to_s
if use_watch_project?
result = Watchman::Utils.query(['watch-project', root], socket)
root = (result, 'watch')
relative_root = (result, 'relative_path') if result.has_key?('relative_path')
else
roots = Watchman::Utils.query(['watch-list'], socket)['roots']
if !roots.include?(root)
result = Watchman::Utils.query(['watch', root], socket)
(result)
end
end
query_params = {
'expression' => ['type', 'f'],
'fields' => ['name'],
}
query_params['relative_root'] = relative_root if relative_root
query = ['query', root, query_params]
paths = Watchman::Utils.query(query, socket)
= (paths, 'files')
if @wildignore
.select { |path| path !~ @wildignore }
else
end
end
rescue Errno::ENOENT, WatchmanError
super
end
|