Fix a bug where directory names of length one or less where not set

properly (examples: "", ".", "a").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18883 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alkis Evlogimenos 2004-12-13 07:41:35 +00:00
parent b8e7df3937
commit 07941b493d
2 changed files with 2 additions and 2 deletions

View File

@ -290,7 +290,7 @@ Path::setDirectory(const std::string& a_path) {
Path save(*this);
path = a_path;
size_t last = a_path.size() -1;
if (last != 0 && a_path[last] != '/')
if (a_path.size() == 0 || a_path[last] != '/')
path += '/';
if (!isValid()) {
path = save.path;

View File

@ -290,7 +290,7 @@ Path::setDirectory(const std::string& a_path) {
Path save(*this);
path = a_path;
size_t last = a_path.size() -1;
if (last != 0 && a_path[last] != '/')
if (a_path.size() == 0 || a_path[last] != '/')
path += '/';
if (!isValid()) {
path = save.path;