diff options
author | Max Kellermann <max@duempel.org> | 2014-05-10 19:00:46 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-05-10 19:00:46 +0200 |
commit | fc1664d9fc432c509c236a5889a0a7ead159e3ba (patch) | |
tree | 85106519cf0e4b2228428bb3f711248b43e0e388 | |
parent | 12768babdfcc99642a343e58af08beb223e2929f (diff) | |
download | mpd-fc1664d9fc432c509c236a5889a0a7ead159e3ba.tar.gz mpd-fc1664d9fc432c509c236a5889a0a7ead159e3ba.tar.xz mpd-fc1664d9fc432c509c236a5889a0a7ead159e3ba.zip |
PlaylistMapper: use map_spl_utf8_to_fs()
Eliminates some overhead and some duplicate code, and fixes a serious
bug: the old code did not append the ".m3u" suffix, and thus the
"load" command was completely broken for stored playlists. D'oh!
-rw-r--r-- | src/playlist/PlaylistMapper.cxx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/playlist/PlaylistMapper.cxx b/src/playlist/PlaylistMapper.cxx index bbcbaf1fe..c50254309 100644 --- a/src/playlist/PlaylistMapper.cxx +++ b/src/playlist/PlaylistMapper.cxx @@ -37,18 +37,10 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond) { assert(spl_valid_name(uri)); - const auto &playlist_directory_fs = map_spl_path(); - if (playlist_directory_fs.IsNull()) + const auto path_fs = map_spl_utf8_to_fs(uri); + if (path_fs.IsNull()) return nullptr; - const auto uri_fs = AllocatedPath::FromUTF8(uri); - if (uri_fs.IsNull()) - return nullptr; - - const auto path_fs = - AllocatedPath::Build(playlist_directory_fs, uri_fs); - assert(!path_fs.IsNull()); - return playlist_open_path(path_fs.c_str(), mutex, cond); } |