summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2014-09-12 23:39:38 +0000
committerJim Ingham <jingham@apple.com>2014-09-12 23:39:38 +0000
commit1adba8b6e308543ef7f45a8beb9853281f46e15d (patch)
tree6dfb2dcb27d8bec4806e620b371e8c953d103a59 /lldb/source
parentcf3f3683f88b74e6d14f5e530f77009c44d8b057 (diff)
downloadbcm5719-llvm-1adba8b6e308543ef7f45a8beb9853281f46e15d.tar.gz
bcm5719-llvm-1adba8b6e308543ef7f45a8beb9853281f46e15d.zip
Don't make paths with /Foo//bar, that confuses everybody down the line.
This gets the file completer for absolute paths working again. llvm-svn: 217722
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 19846d243ed..44364ef9712 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -946,6 +946,8 @@ FileSpec::EnumerateDirectory
lldb_utility::CleanUp <DIR *, int> dir_path_dir(opendir(dir_path), NULL, closedir);
if (dir_path_dir.is_valid())
{
+ char dir_path_last_char = dir_path[strlen(dir_path) - 1];
+
long path_max = fpathconf (dirfd (dir_path_dir.get()), _PC_NAME_MAX);
#if defined (__APPLE_) && defined (__DARWIN_MAXPATHLEN)
if (path_max < __DARWIN_MAXPATHLEN)
@@ -990,7 +992,14 @@ FileSpec::EnumerateDirectory
if (call_callback)
{
char child_path[PATH_MAX];
- const int child_path_len = ::snprintf (child_path, sizeof(child_path), "%s/%s", dir_path, dp->d_name);
+
+ // Don't make paths with "/foo//bar", that just confuses everybody.
+ int child_path_len;
+ if (dir_path_last_char == '/')
+ child_path_len = ::snprintf (child_path, sizeof(child_path), "%s%s", dir_path, dp->d_name);
+ else
+ child_path_len = ::snprintf (child_path, sizeof(child_path), "%s/%s", dir_path, dp->d_name);
+
if (child_path_len < (int)(sizeof(child_path) - 1))
{
// Don't resolve the file type or path
OpenPOWER on IntegriCloud