diff options
author | John Regan <john@jrjrtech.com> | 2017-09-26 08:42:43 -0500 |
---|---|---|
committer | John Regan <john@jrjrtech.com> | 2017-09-26 08:42:43 -0500 |
commit | 9256e748c85b725bcf1045782f839c08e8969975 (patch) | |
tree | 9be666763f384906c6f6bbbe7bfcfe2f20df438b /src/decoder | |
parent | af033c0d1daac4e5c3456ff295aa53cbc864214b (diff) |
GME Plugin: only load m3u if it exists
If you load an NSFE file (which has embedded track titles),
then attempt to load an M3U file, it causes GME to lose all
information found in the NSFE file. This adds a check that
the M3U file exists before attempting to load.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/GmeDecoderPlugin.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index 3f9dbfee1..c8f7ae2d4 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -27,6 +27,7 @@ #include "tag/Builder.hxx" #include "fs/Path.hxx" #include "fs/AllocatedPath.hxx" +#include "fs/FileSystem.hxx" #include "util/ScopeExit.hxx" #include "util/FormatString.hxx" #include "util/UriUtil.hxx" @@ -126,7 +127,14 @@ LoadGmeAndM3u(GmeContainerPath container) { std::string m3u_path(path,suffix); m3u_path += "m3u"; - gme_load_m3u(emu,m3u_path.c_str()); + /* + * Some GME formats lose metadata if you attempt to + * load a non-existant M3U file, so check that one + * exists before loading. + */ + if(FileExists(Path::FromFS(m3u_path.c_str()))) { + gme_load_m3u(emu,m3u_path.c_str()); + } return emu; } |