[Lldb-commits] [lldb] r217723 - Nope, I was right originally. ResolveUsername should resolve "~" to the

Jim Ingham jingham at apple.com
Fri Sep 12 16:50:36 PDT 2014


Author: jingham
Date: Fri Sep 12 18:50:36 2014
New Revision: 217723

URL: http://llvm.org/viewvc/llvm-project?rev=217723&view=rev
Log:
Nope, I was right originally.  ResolveUsername should resolve "~" to the 
current user, and ResolvePartialUsername will resolve "~" to the list of
users.

Modified:
    lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=217723&r1=217722&r2=217723&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Sep 12 18:50:36 2014
@@ -56,7 +56,8 @@ GetFileStats (const FileSpec *file_spec,
 }
 
 // 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<char> &path)
 {
@@ -66,7 +67,7 @@ FileSpec::ResolveUsername (llvm::SmallVe
     
     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;





More information about the lldb-commits mailing list