Fixes issue where non-archive msu-1 files would have improper file extensions

This commit is contained in:
Nick Burtner 2022-11-01 17:50:21 -04:00
parent 55d50c7fbd
commit 86ab38408c
1 changed files with 9 additions and 2 deletions

View File

@ -121,8 +121,15 @@ const char *S9xGetFilename(const char *ex, enum s9x_getdirtype dirtype)
static std::string filename;
fs::path path(S9xGetDirectory(dirtype));
path /= fs::path(Memory.ROMFilename).filename();
path.replace_extension(ex);
filename = path.string();
//Fixes issue with MSU-1 on linux
if(ex[0] == '-') {
path.replace_extension("");
filename = path.string();
filename.append(ex);
} else {
path.replace_extension(ex);
filename = path.string();
}
return filename.c_str();
}