aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/playlist/PlaylistMapper.cxx4
-rw-r--r--src/playlist/PlaylistStream.cxx21
-rw-r--r--src/playlist/PlaylistStream.hxx5
3 files changed, 19 insertions, 11 deletions
diff --git a/src/playlist/PlaylistMapper.cxx b/src/playlist/PlaylistMapper.cxx
index ad92ea6f1..042a39d34 100644
--- a/src/playlist/PlaylistMapper.cxx
+++ b/src/playlist/PlaylistMapper.cxx
@@ -41,7 +41,7 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond)
if (path_fs.IsNull())
return nullptr;
- return playlist_open_path(path_fs.c_str(), mutex, cond);
+ return playlist_open_path(path_fs, mutex, cond);
}
#ifdef ENABLE_DATABASE
@@ -61,7 +61,7 @@ playlist_open_in_storage(const char *uri, const Storage *storage,
{
const auto path = storage->MapFS(uri);
if (!path.IsNull())
- return playlist_open_path(path.c_str(), mutex, cond);
+ return playlist_open_path(path, mutex, cond);
}
const auto uri2 = storage->MapUTF8(uri);
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;
}
diff --git a/src/playlist/PlaylistStream.hxx b/src/playlist/PlaylistStream.hxx
index 02f5485ef..c07ae0b09 100644
--- a/src/playlist/PlaylistStream.hxx
+++ b/src/playlist/PlaylistStream.hxx
@@ -25,18 +25,19 @@
class Mutex;
class Cond;
class SongEnumerator;
+class Path;
/**
* Opens a playlist from a local file.
*
- * @param path_fs the path of the playlist file
+ * @param path the path of the playlist file
* @param is_r on success, an input_stream object is returned here,
* which must be closed after the playlist_provider object is freed
* @return a playlist, or nullptr on error
*/
gcc_nonnull_all
SongEnumerator *
-playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond);
+playlist_open_path(Path path, Mutex &mutex, Cond &cond);
gcc_nonnull_all
SongEnumerator *