diff options
author | Max Kellermann <max@duempel.org> | 2014-10-02 18:53:55 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-02 22:02:11 +0200 |
commit | 44d2d9b1e83d5f7a1a295f9b4f7696d5d7902c14 (patch) | |
tree | 8208cafe76e564ce00df322584ea8d454681e0d5 /src/playlist/PlaylistStream.cxx | |
parent | 8302ed44aa4918a647bdbe8bf69fb3d92833a427 (diff) | |
download | mpd-44d2d9b1e83d5f7a1a295f9b4f7696d5d7902c14.tar.gz mpd-44d2d9b1e83d5f7a1a295f9b4f7696d5d7902c14.tar.xz mpd-44d2d9b1e83d5f7a1a295f9b4f7696d5d7902c14.zip |
PlaylistStream: pass Path instance to playlist_open_path()
Convert filesystem charset to UTF-8 for playlist_list_open_uri().
This fixes one of many remaining charset bugs.
Diffstat (limited to '')
-rw-r--r-- | src/playlist/PlaylistStream.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/playlist/PlaylistStream.cxx b/src/playlist/PlaylistStream.cxx index 5855c598b..123dbdb6c 100644 --- a/src/playlist/PlaylistStream.cxx +++ b/src/playlist/PlaylistStream.cxx @@ -24,21 +24,23 @@ #include "util/UriUtil.hxx" #include "util/Error.hxx" #include "input/InputStream.hxx" +#include "fs/Path.hxx" #include "Log.hxx" #include <assert.h> static SongEnumerator * -playlist_open_path_suffix(const char *path_fs, Mutex &mutex, Cond &cond) +playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond) { - assert(path_fs != nullptr); + assert(!path.IsNull()); - const char *suffix = uri_get_suffix(path_fs); + const char *suffix = uri_get_suffix(path.c_str()); if (suffix == nullptr || !playlist_suffix_supported(suffix)) return nullptr; Error error; - InputStream *is = InputStream::OpenReady(path_fs, mutex, cond, error); + InputStream *is = InputStream::OpenReady(path.c_str(), + mutex, cond, error); if (is == nullptr) { if (error.IsDefined()) LogError(error); @@ -56,11 +58,16 @@ playlist_open_path_suffix(const char *path_fs, Mutex &mutex, Cond &cond) } SongEnumerator * -playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond) +playlist_open_path(Path path, Mutex &mutex, Cond &cond) { - auto playlist = playlist_list_open_uri(path_fs, mutex, cond); + assert(!path.IsNull()); + + const std::string uri_utf8 = path.ToUTF8(); + auto playlist = !uri_utf8.empty() + ? playlist_list_open_uri(uri_utf8.c_str(), mutex, cond) + : nullptr; if (playlist == nullptr) - playlist = playlist_open_path_suffix(path_fs, mutex, cond); + playlist = playlist_open_path_suffix(path, mutex, cond); return playlist; } |