module FileUtils
Public Class Methods
where(executable_sought)
click to toggle source
# 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
which(executable_sought)
click to toggle source
# File lib/FileUtils/which.rb, line 10 def which(executable_sought) if where_results = FileUtils.where(executable_sought) where_results[0] else nil end end
Private Instance Methods
where(executable_sought)
click to toggle source
# 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
which(executable_sought)
click to toggle source
# File lib/FileUtils/which.rb, line 10 def which(executable_sought) if where_results = FileUtils.where(executable_sought) where_results[0] else nil end end