From ead45ccc2c71e59413cc838e9f3aa65196793d75 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 12 Sep 2014 23:50:36 +0000 Subject: [PATCH] Nope, I was right originally. ResolveUsername should resolve "~" to the current user, and ResolvePartialUsername will resolve "~" to the list of users. llvm-svn: 217723 --- lldb/source/Host/common/FileSpec.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 44364ef9712d..7c5a5ccc48e5 100644 --- a/lldb/source/Host/common/FileSpec.cpp +++ b/lldb/source/Host/common/FileSpec.cpp @@ -56,7 +56,8 @@ GetFileStats (const FileSpec *file_spec, struct stat *stats_ptr) } // Resolves the username part of a path of the form ~user/other/directories, and -// writes the result into dst_path. +// writes the result into dst_path. This will also resolve "~" to the current user. +// If you want to complete "~" to the list of users, pass it to ResolvePartialUsername. void FileSpec::ResolveUsername (llvm::SmallVectorImpl &path) { @@ -66,7 +67,7 @@ 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.size() == 1) { // A path of ~/ resolves to the current user's home dir llvm::SmallString<64> home_dir;