Sha256: f90bcd3750a58cac25fdef4ac1f8ff5cc2172fed0bc133284d21d6e63606f369

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

require_relative 'command_handler'

module Ftpd

  class CmdNlst < CommandHandler

    def cmd_nlst(argument)
      close_data_server_socket_when_done do
        ensure_logged_in
        ensure_file_system_supports :dir
        path = list_path(argument)
        path = File.expand_path(path, name_prefix)
        transmit_file(StringIO.new(name_list(path)), 'A')
      end
    end

    private

    def name_list(target_path)
      path_list(target_path).map do |path|
        File.basename(path) + "\n"
      end.join
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ftpd-2.1.0 lib/ftpd/cmd_nlst.rb