Index: include/lldb/Host/FileSpec.h =================================================================== --- include/lldb/Host/FileSpec.h +++ include/lldb/Host/FileSpec.h @@ -259,9 +259,13 @@ /// /// @param[in] s /// The stream to which to dump the object description. + /// + /// @param[in] trailing_slash + /// If true and the file is a non root directory, then a trailing slash + /// will be added. //------------------------------------------------------------------ void - Dump (Stream *s) const; + Dump(Stream *s, bool trailing_slash = true) const; //------------------------------------------------------------------ /// Existence test. Index: source/Host/common/FileSpec.cpp =================================================================== --- source/Host/common/FileSpec.cpp +++ source/Host/common/FileSpec.cpp @@ -609,12 +609,13 @@ // directory delimiter, and the filename. //------------------------------------------------------------------ void -FileSpec::Dump(Stream *s) const +FileSpec::Dump(Stream *s, bool trailing_slash) const { if (s) { m_directory.Dump(s); - if (m_directory && m_directory.GetStringRef().back() != '/') + if ((m_filename || trailing_slash) && m_directory && + !m_directory.GetStringRef().endswith("/")) s->PutChar('/'); m_filename.Dump(s); } @@ -816,7 +817,7 @@ FileSpec::GetPath(llvm::SmallVectorImpl &path, bool denormalize) const { StreamString stream; - Dump(&stream); + Dump(&stream, false); path.append(stream.GetString().begin(), stream.GetString().end()); Normalize(path, m_syntax); if (denormalize && !path.empty())