From 1f74222bf4cfadead768b095c6b3f8d422ebf84c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Feb 2022 00:42:21 +0100 Subject: Add local-manga plugin to read local manga --- include/Path.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/Path.hpp') 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('/'); -- cgit v1.2.3-70-g09d2