From 2614db1a130bee7d261d4cea1734b3d379092992 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 12 Sep 2014 22:59:05 +0000 Subject: [PATCH] ResolveUsername should resolve "~" to the user's home directory as well as "~/". This gets command-line file completion from ~ working again. llvm-svn: 217719 --- lldb/source/Host/common/FileSpec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 8c4014c074f5..d011d39d88d6 100644 --- a/lldb/source/Host/common/FileSpec.cpp +++ b/lldb/source/Host/common/FileSpec.cpp @@ -66,9 +66,9 @@ FileSpec::ResolveUsername (llvm::SmallVectorImpl &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;