Changeset - r22998:f69835b832fd
[Not reviewed]
master
0 1 0
Niels Martin Hansen - 6 years ago 2018-09-03 16:43:55
nielsm@indvikleren.dk
Fix: Better "temp" path for decoded MPSMIDI files when source filename has no path separators
1 file changed with 8 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/music/midifile.cpp
Show inline comments
 
@@ -1020,16 +1020,18 @@ std::string MidiFile::GetSMFFile(const M
 

	
 
	if (song.filetype != MTT_MPSMIDI) return std::string();
 

	
 
	const char *lastpathsep = strrchr(song.filename, PATHSEPCHAR);
 
	if (lastpathsep == NULL) {
 
		lastpathsep = song.filename;
 
	}
 

	
 
	char basename[MAX_PATH];
 
	{
 
		const char *fnstart = strrchr(song.filename, PATHSEPCHAR);
 
		if (fnstart == NULL) {
 
			fnstart = song.filename;
 
		} else {
 
			fnstart++;
 
		}
 

	
 
		/* Remove all '.' characters from filename */
 
		char *wp = basename;
 
		for (const char *rp = lastpathsep + 1; *rp != '\0'; rp++) {
 
		for (const char *rp = fnstart; *rp != '\0'; rp++) {
 
			if (*rp != '.') *wp++ = *rp;
 
		}
 
		*wp++ = '\0';
0 comments (0 inline, 0 general)