From 07941b493dfeb11996690cfa2fc14c7c0bd7bb91 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Mon, 13 Dec 2004 07:41:35 +0000 Subject: [PATCH] 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 --- lib/System/Unix/Path.cpp | 2 +- lib/System/Unix/Path.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/System/Unix/Path.cpp b/lib/System/Unix/Path.cpp index e655ef40cdf..4b5ccb93448 100644 --- a/lib/System/Unix/Path.cpp +++ b/lib/System/Unix/Path.cpp @@ -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; diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index e655ef40cdf..4b5ccb93448 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -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;