aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-14 21:40:56 +0200
committerMax Kellermann <max@duempel.org>2013-10-14 21:40:56 +0200
commit8cf2f52f7acfd22dc85e0ed5ef6bd04cf55d31aa (patch)
tree4c271037a0a985b7b9c511856fda0791f60fabf0 /src
parent17c6db6c33b9b14a8627b3f9b3da8580a5f932a2 (diff)
parent681352ac3bc2abe12ebabbf6e4e3258384beb65b (diff)
downloadmpd-8cf2f52f7acfd22dc85e0ed5ef6bd04cf55d31aa.tar.gz
mpd-8cf2f52f7acfd22dc85e0ed5ef6bd04cf55d31aa.tar.xz
mpd-8cf2f52f7acfd22dc85e0ed5ef6bd04cf55d31aa.zip
Merge tag 'release-0.17.6'
Diffstat (limited to 'src')
-rw-r--r--src/PlaylistFile.cxx17
-rw-r--r--src/PlaylistSave.cxx10
2 files changed, 24 insertions, 3 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 793ee5e58..e01bc1d26 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -241,7 +241,13 @@ LoadPlaylistFile(const char *utf8path, Error &error)
if (*s == 0 || *s == PLAYLIST_COMMENT)
continue;
- if (!uri_has_scheme(s)) {
+ if (g_path_is_absolute(s)) {
+ const auto path = Path::ToUTF8(s);
+ if (path.empty())
+ continue;
+
+ s = g_strconcat("file://", path.c_str(), NULL);
+ } else if (!uri_has_scheme(s)) {
char *path_utf8;
path_utf8 = map_fs_to_utf8(s);
@@ -249,8 +255,13 @@ LoadPlaylistFile(const char *utf8path, Error &error)
continue;
s = path_utf8;
- } else
- s = g_strdup(s);
+ } else {
+ const auto path = Path::ToUTF8(s);
+ if (path.empty())
+ continue;
+
+ s = g_strdup(path.c_str());
+ }
contents.emplace_back(s);
if (contents.size() >= playlist_max_length)
diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx
index 12c82dc73..6e17b6fc3 100644
--- a/src/PlaylistSave.cxx
+++ b/src/PlaylistSave.cxx
@@ -33,6 +33,8 @@
#include <glib.h>
+#include <string.h>
+
void
playlist_print_song(FILE *file, const Song *song)
{
@@ -114,6 +116,14 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc,
for (unsigned i = start_index; i < end_index; ++i) {
const auto &uri_utf8 = contents[i];
+ if (memcmp(uri_utf8.c_str(), "file:///", 8) == 0) {
+ const char *path_utf8 = uri_utf8.c_str() + 7;
+
+ if (playlist->AppendFile(*pc, path_utf8) != PLAYLIST_RESULT_SUCCESS)
+ g_warning("can't add file \"%s\"", path_utf8);
+ continue;
+ }
+
if ((playlist->AppendURI(*pc, uri_utf8.c_str())) != PLAYLIST_RESULT_SUCCESS) {
/* for windows compatibility, convert slashes */
char *temp2 = g_strdup(uri_utf8.c_str());