diff options
author | Max Kellermann <max@musicpd.org> | 2020-06-10 20:58:46 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-06-10 21:22:00 +0200 |
commit | aafc9ce75bbbb8b3195298eba6c457af01f16ee0 (patch) | |
tree | f76a0320d2167b0c3a12e94b4cf85061fc1d0cfb /src | |
parent | fea326530b9b0fda6d4047511b7f455c5637a83b (diff) |
decoder/gme: use class NarrowPath() for Windows compatibility
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/plugins/GmeDecoderPlugin.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index 3327e1b51..98d47fb3f 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -27,6 +27,7 @@ #include "fs/Path.hxx" #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" +#include "fs/NarrowPath.hxx" #include "util/ScopeExit.hxx" #include "util/StringCompare.hxx" #include "util/StringFormat.hxx" @@ -96,7 +97,7 @@ ParseContainerPath(Path path_fs) const Path base = path_fs.GetBase(); unsigned track; if (base.IsNull() || - (track = ParseSubtuneName(base.c_str())) < 1) + (track = ParseSubtuneName(NarrowPath(base))) < 1) return { AllocatedPath(path_fs), 0 }; return { path_fs.GetDirectoryName(), track - 1 }; @@ -120,20 +121,21 @@ LoadGmeAndM3u(GmeContainerPath container) { Music_Emu *emu; const char *gme_err = - gme_open_file(container.path.c_str(), &emu, GME_SAMPLE_RATE); + gme_open_file(NarrowPath(container.path), &emu, GME_SAMPLE_RATE); if (gme_err != nullptr) { LogWarning(gme_domain, gme_err); return nullptr; } - const auto m3u_path = ReplaceSuffix(container.path, "m3u"); + const auto m3u_path = ReplaceSuffix(container.path, + PATH_LITERAL("m3u")); /* * Some GME formats lose metadata if you attempt to * load a non-existant M3U file, so check that one * exists before loading. */ if (!m3u_path.IsNull() && FileExists(m3u_path)) - gme_load_m3u(emu, m3u_path.c_str()); + gme_load_m3u(emu, NarrowPath(m3u_path)); return emu; } |