aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Unix
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-07 21:53:57 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-07 21:53:57 +0000
commitcf55c8e221c1d31a361f99ee49078d261cdf431c (patch)
treeffd732ba6a0d8ee6a30846cab129eb6143a244d8 /lib/System/Unix
parenta0562001d05101975ec88248a0bb5518074543dc (diff)
Added method Path::getDirname().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r--lib/System/Unix/Path.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index c3d06a3fa1..fe2e3c6777 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -277,16 +277,18 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) {
}
+std::string Path::getDirname() const { return getDirnameCharSep('/'); }
+
std::string
Path::getBasename() const {
// Find the last slash
- size_t slash = path.rfind('/');
+ std::string::size_type slash = path.rfind('/');
if (slash == std::string::npos)
slash = 0;
else
slash++;
- size_t dot = path.rfind('.');
+ std::string::size_type dot = path.rfind('.');
if (dot == std::string::npos || dot < slash)
return path.substr(slash);
else