aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapper.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-24 22:04:24 +0100
committerMax Kellermann <max@duempel.org>2008-12-24 22:04:24 +0100
commit1bd3cde062deb3b61872f89ad02fc5d70cff375d (patch)
treed7b355cc44a271f13eba83ef476c6f0ae419fe35 /src/mapper.c
parenta94e59ca2192a9ba80d5ab1919dc25918ce4163c (diff)
downloadmpd-1bd3cde062deb3b61872f89ad02fc5d70cff375d.tar.gz
mpd-1bd3cde062deb3b61872f89ad02fc5d70cff375d.tar.xz
mpd-1bd3cde062deb3b61872f89ad02fc5d70cff375d.zip
playlist: fix stored playlist modifications with absolute paths
When save_absolute_paths_in_playlists was enabled in mpd.conf, MPD broke all playlists when manipulated using the "playlistdelete" command. The reason was that map_directory_child_fs() was used, which doesn't accept slashes in the file name. Use the new map_uri_fs() function instead.
Diffstat (limited to '')
-rw-r--r--src/mapper.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mapper.c b/src/mapper.c
index 6317c2f77..b3f86da00 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -84,13 +84,23 @@ rmp2amp_r(char *dst, const char *rel_path)
}
const char *
+map_uri_fs(const char *uri, char *buffer)
+{
+ assert(uri != NULL);
+ assert(*uri != '/');
+ assert(buffer != NULL);
+
+ return rmp2amp_r(buffer, utf8_to_fs_charset(buffer, uri));
+}
+
+const char *
map_directory_fs(const struct directory *directory, char *buffer)
{
const char *dirname = directory_get_path(directory);
if (isRootDirectory(dirname))
return music_dir;
- return rmp2amp_r(buffer, utf8_to_fs_charset(buffer, dirname));
+ return map_uri_fs(dirname, buffer);
}
const char *