Module: Utilities
- Included in:
- CommandLine_Exe
- Defined in:
- lib/utilities.rb
Class Method Summary collapse
Class Method Details
.which(cmd) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/utilities.rb', line 4 def Utilities.which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable? exe } end return nil end |