Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
63:3d2decf093bb | 64:fe719c109dbc |
---|---|
65 return stat(_path.c_str(), &st) == 0; | 65 return stat(_path.c_str(), &st) == 0; |
66 #endif | 66 #endif |
67 } | 67 } |
68 | 68 |
69 std::string Path::Basename() const { | 69 std::string Path::Basename() const { |
70 return _path.substr(0, _path.find_last_of(DELIM)); | 70 unsigned long long pos = _path.find_last_of(DELIM); |
71 return pos != std::string::npos ? _path.substr(pos+1, _path.length()) : ""; | |
71 } | 72 } |
72 | 73 |
73 std::string Path::Stem() const { | 74 std::string Path::Stem() const { |
74 std::string basename = Basename(); | 75 std::string basename = Basename(); |
75 return basename.substr(0, basename.find_last_of(".")); | 76 unsigned long long pos = basename.find_last_of("."); |
77 return pos != std::string::npos ? basename.substr(0, pos) : ""; | |
76 } | 78 } |
77 | 79 |
78 std::string Path::Extension() const { | 80 std::string Path::Extension() const { |
79 std::string basename = Basename(); | 81 std::string basename = Basename(); |
80 return basename.substr(basename.find_last_of("."), basename.length()); | 82 unsigned long long pos = basename.find_last_of("."); |
83 return pos != std::string::npos ? basename.substr(pos+1, basename.length()) : ""; | |
81 } | 84 } |
82 | 85 |
83 Path Path::GetParent() const { | 86 Path Path::GetParent() const { |
84 return _path.substr(0, _path.find_last_of(DELIM)); | 87 return _path.substr(0, _path.find_last_of(DELIM)); |
85 } | 88 } |