# File lib/rye.rb, line 186 186: def which(executable) 187: return unless executable.is_a?(String) 188: return executable if Rye.sysinfo.os == :windows 189: #return executable if File.exists?(executable) # SHOULD WORK, MUST TEST 190: shortname = File.basename(executable) 191: dir = Rye.sysinfo.paths.select do |path| # dir contains all of the 192: next unless File.exists? path # occurrences of shortname 193: Dir.new(path).entries.member?(shortname) # found in the paths. 194: end 195: File.join(dir.first, shortname) unless dir.empty? # Return just the first 196: end