only add a / if one wasn't there before; update comments/documentation to reflect the current reality now that #968 and #664 are fixed

git-svn-id: file:///home/svn/framework3/trunk@11452 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2010-12-29 21:10:14 +00:00
parent 9f05e02b85
commit efafb793c4
1 changed files with 5 additions and 6 deletions

View File

@ -102,15 +102,14 @@ module CommandDispatcher
#
# Provide a generic tab completion for file names.
#
# This currently works with the system readline (i.e. when msfconsole was
# invoked with -i) for everything but doesn't do more than files the
# current directory in the bundled rbreadline. In rbreadline anything with
# a / will fail to complete.
# If the only completion is a directory, this descends into that directory
# and continues completions with filenames contained within.
#
def tab_complete_filenames(str, words)
matches = ::Readline::FILENAME_COMPLETION_PROC.call(str)
if matches and matches.length == 1 and File.directory?(matches[0])
dir = (matches[0] + File::SEPARATOR)
dir = matches[0]
dir += File::SEPARATOR if dir[-1,1] != File::SEPARATOR
matches = ::Readline::FILENAME_COMPLETION_PROC.call(dir)
end
matches
@ -120,7 +119,7 @@ module CommandDispatcher
# The driver that this command dispatcher is associated with.
#
attr_accessor :driver
end
###