ResolveUsername should resolve "~" to the user's home directory as well as "~/". This

gets command-line file completion from ~ working again.

llvm-svn: 217719
This commit is contained in:
Jim Ingham 2014-09-12 22:59:05 +00:00
parent 7506dc06f4
commit 2614db1a13
1 changed files with 2 additions and 2 deletions

View File

@ -66,9 +66,9 @@ FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path)
llvm::StringRef path_str(path.data());
size_t slash_pos = path_str.find_first_of("/", 1);
if (slash_pos == 1)
if (slash_pos == 1 || path_str.size() == 1)
{
// A path of the form ~/ resolves to the current user's home dir
// A path of the form ~ or ~/ resolves to the current user's home dir
llvm::SmallString<64> home_dir;
if (!llvm::sys::path::home_directory(home_dir))
return;