diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-07 21:53:57 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-07 21:53:57 +0000 |
commit | c042bf1db5f6aedd4a677950f9322675cca46d66 (patch) | |
tree | a30fc3f8c352661a4c78606027e4e88f77c7dd1c /llvm/lib/System/Unix | |
parent | 3a130675572b3c51f605b17db5c2b89ee115e03a (diff) | |
download | bcm5719-llvm-c042bf1db5f6aedd4a677950f9322675cca46d66.tar.gz bcm5719-llvm-c042bf1db5f6aedd4a677950f9322675cca46d66.zip |
Added method Path::getDirname().
llvm-svn: 49352
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index c3d06a3fa1d..fe2e3c67778 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/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 |