Method: Xnlogic.which

Defined in:
lib/xnlogic.rb

.which(executable) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/xnlogic.rb', line 22

def which(executable)
  if File.file?(executable) && File.executable?(executable)
    executable
  elsif ENV['PATH']
    path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
      File.executable?(File.join(p, executable))
    end
    path && File.expand_path(executable, path)
  end
end