# File lib/facter/core/execution/windows.rb, line 9 def which(bin) if absolute_path?(bin) return bin if File.executable?(bin) else search_paths.each do |dir| dest = File.join(dir, bin) dest.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File.extname(dest).empty? exts = ENV['PATHEXT'] exts = exts ? exts.split(File::PATH_SEPARATOR) : DEFAULT_COMMAND_EXTENSIONS exts.each do |ext| destext = dest + ext return destext if File.executable?(destext) end end return dest if File.executable?(dest) end end nil end