diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-11 00:42:21 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-11 00:42:21 +0100 |
commit | 1f74222bf4cfadead768b095c6b3f8d422ebf84c (patch) | |
tree | 39035288edb79852cef6237f0d7ab8ea146cf218 /include/Path.hpp | |
parent | 404ac476a213164a041f0f53be30855df815aa6a (diff) |
Add local-manga plugin to read local manga
Diffstat (limited to 'include/Path.hpp')
-rw-r--r-- | include/Path.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/Path.hpp b/include/Path.hpp index fe49265..bb08cc6 100644 --- a/include/Path.hpp +++ b/include/Path.hpp @@ -21,6 +21,7 @@ namespace QuickMedia { return *this; } + // Includes extension const char* filename() const { size_t index = data.rfind('/'); if(index == std::string::npos) @@ -28,6 +29,15 @@ namespace QuickMedia { return data.c_str() + index + 1; } + std::string filename_no_ext() const { + const char *name = filename(); + const char *extension = ext(); + if(extension[0] == '\0') + return name; + else + return data.substr(name - data.data(), extension - name); + } + // Returns empty string if no extension const char* ext() const { size_t slash_index = data.rfind('/'); |