[Lldb-commits] [lldb] r250770 - When calling FileSpec::AppendPathComponent() we don't need to include "." in the path if m_filename is set to exactly '.'. Previously this would cause a FileSpec object that looked like:

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 19 17:17:39 PDT 2015


Author: gclayton
Date: Mon Oct 19 19:17:39 2015
New Revision: 250770

URL: http://llvm.org/viewvc/llvm-project?rev=250770&view=rev
Log:
When calling FileSpec::AppendPathComponent() we don't need to include "." in the path if m_filename is set to exactly '.'. Previously this would cause a FileSpec object that looked like:

m_directory = "/tmp"
m_filename = "."
                                         
To look like:

m_directory = "/tmp/."
m_filename = "foo.txt"

if "foo.txt" was appended to it. With this fix it will be:

m_directory = "/tmp"
m_filename = "foo.txt"



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=250770&r1=250769&r2=250770&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Oct 19 19:17:39 2015
@@ -1431,7 +1431,7 @@ FileSpec::AppendPathComponent(const char
         return;
     }
     StreamString stream;
-    if (m_filename.IsEmpty())
+    if (m_filename.IsEmpty() || (m_filename.GetLength() == 1 && m_filename.GetCString()[0] == '.'))
         stream.Printf("%s/%s", m_directory.GetCString(), new_path);
     else if (m_directory.IsEmpty())
         stream.Printf("%s/%s", m_filename.GetCString(), new_path);




More information about the lldb-commits mailing list