Module: Kernel

Defined in:
lib/launchcraft/java.rb

Class Method Summary collapse

Class Method Details

.which(bin, which = 0) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/launchcraft/java.rb', line 30

def self.which (bin, which=0)
  bin << '.exe' if OS.windows? and bin !~ /\.exe$/

  res = Dir.path.map {|path|
    File.join(path, bin)
  }.select {|bin|
    File.executable_real?(bin)
  }

  if which == :all
    res
  elsif which.is_a?(Integer)
    res[which]
  else
    res[0]
  end
end