20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/FileUtils/where.rb', line 20
def where(executable_sought)
paths = ENV['PATH'].split(/:/)
sought_paths = []
paths.uniq.each do |path|
Dir["#{path}/*"].each do |executable|
if Platform::OS.windows?
sought_paths << executable if File.basename_without_extname(executable) == File.basename_without_extname(executable_sought)
else
sought_paths << executable if File.basename(executable) == executable_sought
end
end
end
sought_paths.empty? ? nil : sought_paths
end
|