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. # Provide a generic tab completion for file names.
# #
# This currently works with the system readline (i.e. when msfconsole was # If the only completion is a directory, this descends into that directory
# invoked with -i) for everything but doesn't do more than files the # and continues completions with filenames contained within.
# current directory in the bundled rbreadline. In rbreadline anything with
# a / will fail to complete.
# #
def tab_complete_filenames(str, words) def tab_complete_filenames(str, words)
matches = ::Readline::FILENAME_COMPLETION_PROC.call(str) matches = ::Readline::FILENAME_COMPLETION_PROC.call(str)
if matches and matches.length == 1 and File.directory?(matches[0]) 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) matches = ::Readline::FILENAME_COMPLETION_PROC.call(dir)
end end
matches matches