class Launchy::Application

def find_executable(bin, *paths)

returns the path to the executable or nil if not found

Find the given executable in the available paths
def find_executable(bin, *paths)
  paths = Launchy.path.split(File::PATH_SEPARATOR) if paths.empty?
  paths.each do |path|
    file = File.join(path, bin)
    if File.executable?(file)
      Launchy.log "#{name} : found executable #{file}"
      return file
    end
  end
  Launchy.log "#{name} : Unable to find `#{bin}' in #{paths.join(', ')}"
  nil
end