Sha256: 6ce87ef796b8b31a062e2895d38ad42f1d9a58af0589a757b480288de6921ac5

Contents?: true

Size: 512 Bytes

Versions: 5

Compression:

Stored size: 512 Bytes

Contents

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(name_list(path), 'A')
      end
    end

    private

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

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ftpd-0.16.0 lib/ftpd/cmd_nlst.rb
ftpd-0.15.0 lib/ftpd/cmd_nlst.rb
ftpd-0.14.0 lib/ftpd/cmd_nlst.rb
ftpd-0.13.0 lib/ftpd/cmd_nlst.rb
ftpd-0.12.0 lib/ftpd/cmd_nlst.rb