diff src/core/filesystem.cpp @ 64:fe719c109dbc

*: update 1. add media tracking ability, and it displays info on the `now playing` page 2. the `now playing` page now actually shows something 3. renamed every page class to be more accurate to what it is 4. ...
author Paper <mrpapersonic@gmail.com>
date Sun, 01 Oct 2023 23:15:43 -0400
parents 3d2decf093bb
children 3364fadc8a36
line wrap: on
line diff
--- a/src/core/filesystem.cpp	Sun Oct 01 06:39:47 2023 -0400
+++ b/src/core/filesystem.cpp	Sun Oct 01 23:15:43 2023 -0400
@@ -67,17 +67,20 @@
 }
 
 std::string Path::Basename() const {
-	return _path.substr(0, _path.find_last_of(DELIM));
+	unsigned long long pos = _path.find_last_of(DELIM);
+	return pos != std::string::npos ? _path.substr(pos+1, _path.length()) : "";
 }
 
 std::string Path::Stem() const {
 	std::string basename = Basename();
-	return basename.substr(0, basename.find_last_of("."));
+	unsigned long long pos = basename.find_last_of(".");
+	return pos != std::string::npos ? basename.substr(0, pos) : "";
 }
 
 std::string Path::Extension() const {
 	std::string basename = Basename();
-	return basename.substr(basename.find_last_of("."), basename.length());
+	unsigned long long pos = basename.find_last_of(".");
+	return pos != std::string::npos ? basename.substr(pos+1, basename.length()) : "";
 }
 
 Path Path::GetParent() const {