Module: Kernel

Defined in:
lib/launchcraft/java.rb

Class Method Summary collapse

Class Method Details

.which(bin, which = 0) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/launchcraft/java.rb', line 48

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