Class: Pacproxy::Util
- Inherits:
-
Object
- Object
- Pacproxy::Util
- Defined in:
- lib/pacproxy/util.rb
Overview
Pacproxy::PacUtil is utility
Class Method Summary collapse
Class Method Details
.which(cmd) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/pacproxy/util.rb', line 6 def self.which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable?(exe) && !File.directory?(exe) end end nil end |