[Lldb-commits] [lldb] r217719 - ResolveUsername should resolve "~" to the user's home directory as well as "~/". This

Jim Ingham jingham at apple.com
Fri Sep 12 15:59:05 PDT 2014


Author: jingham
Date: Fri Sep 12 17:59:05 2014
New Revision: 217719

URL: http://llvm.org/viewvc/llvm-project?rev=217719&view=rev
Log:
ResolveUsername should resolve "~" to the user's home directory as well as "~/".  This 
gets command-line file completion from ~ working again.

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=217719&r1=217718&r2=217719&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Sep 12 17:59:05 2014
@@ -66,9 +66,9 @@ 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_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;





More information about the lldb-commits mailing list