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"

llvm-svn: 250770
This commit is contained in:
Greg Clayton 2015-10-20 00:17:39 +00:00
parent 7869148c47
commit 5b94e11873
1 changed files with 1 additions and 1 deletions

View File

@ -1431,7 +1431,7 @@ FileSpec::AppendPathComponent(const char *new_path)
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);