Method: CDK::FSELECT#inject

Defined in:
lib/cdk/components/fselect.rb

#inject(input) ⇒ Object

This injects a single character into the file selector.



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/cdk/components/fselect.rb', line 490

def inject(input)
  ret = -1
  @complete = false

  # Let the user play.
  filename = @entry_field.inject(input)

  # Copy the entry field exit_type to the file selector.
  @exit_type = @entry_field.exit_type

  # If we exited early, make sure we don't interpret it as a file.
  if @exit_type == :EARLY_EXIT
    return 0
  end

  # Can we change into the directory
  #file = Dir.chdir(filename)
  #if Dir.chdir(@pwd) != 0
  #  return 0
  #end

  # If it's not a directory, return the filename.
  if !Dir.exists?(filename)
    # It's a regular file, create the full path
    @pathname = filename.clone

    # Return the complete pathname.
    ret = @pathname
    @complete = true
  else
    # Set the file selector information.
    self.set(filename, @field_attribute, @filler_character, @highlight,
        @dir_attribute, @file_attribute, @link_attribute, @sock_attribute,
        @box)

    # Redraw the scrolling list.
    self.drawMyScroller
  end

  if !@complete
    self.setExitType(0)
  end

  @result_data = ret
  return ret
end