Merge pull request #795 from kbrighton/msu-1-gtk-fix

Fixes issue where non-archive msu-1 files would have improper file extensions
This commit is contained in:
bearoso 2022-11-03 12:06:23 -05:00 committed by GitHub
commit 96983736ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();
}