mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Added method Path::getDirname().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user