Add helper functions to get last path segment

This commit is contained in:
Jonathan G Rennison
2024-01-05 22:13:17 +00:00
parent 7fdcbced09
commit 0ab4b8ea31
5 changed files with 22 additions and 15 deletions

View File

@@ -1051,12 +1051,7 @@ std::string MidiFile::GetSMFFile(const MusicSongInfo &song)
char basename[MAX_PATH];
{
const char *fnstart = strrchr(song.filename.c_str(), PATHSEPCHAR);
if (fnstart == nullptr) {
fnstart = song.filename.c_str();
} else {
fnstart++;
}
const char *fnstart = StrLastPathSegment(song.filename);
/* Remove all '.' characters from filename */
char *wp = basename;