diff options
author | Jim Ingham <jingham@apple.com> | 2014-09-12 23:50:36 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2014-09-12 23:50:36 +0000 |
commit | ead45ccc2c71e59413cc838e9f3aa65196793d75 (patch) | |
tree | 175d1d323dcd501680e54d31f27bc1c01983fb1b /lldb/source/Host/common/FileSpec.cpp | |
parent | 1adba8b6e308543ef7f45a8beb9853281f46e15d (diff) | |
download | bcm5719-llvm-ead45ccc2c71e59413cc838e9f3aa65196793d75.tar.gz bcm5719-llvm-ead45ccc2c71e59413cc838e9f3aa65196793d75.zip |
Nope, I was right originally. ResolveUsername should resolve "~" to the
current user, and ResolvePartialUsername will resolve "~" to the list of
users.
llvm-svn: 217723
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r-- | lldb/source/Host/common/FileSpec.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 44364ef9712..7c5a5ccc48e 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<char> &path) { @@ -66,7 +67,7 @@ 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.size() == 1) { // A path of ~/ resolves to the current user's home dir llvm::SmallString<64> home_dir; |