diff options
Diffstat (limited to 'lib/System/Win32/Path.inc')
-rw-r--r-- | lib/System/Win32/Path.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index b5897053..8f33664 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -259,6 +259,22 @@ Path::getBasename() const { return path.substr(slash, dot - slash); } +std::string +Path::getSuffix() const { + // Find the last slash + size_t slash = path.rfind('/'); + if (slash == std::string::npos) + slash = 0; + else + slash++; + + size_t dot = path.rfind('.'); + if (dot == std::string::npos || dot < slash) + return std::string(); + else + return path.substr(dot + 1); +} + bool Path::exists() const { DWORD attr = GetFileAttributes(path.c_str()); |