class Aruba::Platforms::WindowsWhich::ProgramWhich
Find path for command
def self.match?(program)
def self.match?(program) Aruba.platform.command?(program) end
def call(program, path)
def call(program, path) # Iterate over each path glob the dir + program. path.split(File::PATH_SEPARATOR).each do |dir| dir = Aruba.platform.expand_path(dir, Dir.getwd) next unless Aruba.platform.exist?(dir) # In case of bogus second argument file = File.join(dir, program) # Dir[] doesn't handle backslashes properly, so convert them. Also, if # the program name doesn't have an extension, try them all. file = file.tr("\\", "/") found = Dir[file].first # Convert all forward slashes to backslashes if supported if found && Aruba.platform.executable?(found) found.tr!(File::SEPARATOR, File::ALT_SEPARATOR) return found end end nil end