Sha256: 4f60227fba5fe8620e825bc455af59e8d1ca81f64a2c0c53e77fc2d4748defea

Contents?: true

Size: 526 Bytes

Versions: 6

Compression:

Stored size: 526 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(StringIO.new(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

6 entries across 6 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_nlst.rb
ftpd-1.1.0 lib/ftpd/cmd_nlst.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_nlst.rb
ftpd-1.0.1 lib/ftpd/cmd_nlst.rb
ftpd-1.0.0 lib/ftpd/cmd_nlst.rb
ftpd-0.17.0 lib/ftpd/cmd_nlst.rb