From 1bd3cde062deb3b61872f89ad02fc5d70cff375d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Dec 2008 22:04:24 +0100 Subject: 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. --- src/mapper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/mapper.c') diff --git a/src/mapper.c b/src/mapper.c index 6317c2f7..b3f86da0 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -83,6 +83,16 @@ rmp2amp_r(char *dst, const char *rel_path) return dst; } +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) { @@ -90,7 +100,7 @@ map_directory_fs(const struct directory *directory, char *buffer) if (isRootDirectory(dirname)) return music_dir; - return rmp2amp_r(buffer, utf8_to_fs_charset(buffer, dirname)); + return map_uri_fs(dirname, buffer); } const char * -- cgit v1.2.3