From 3341b282b7e7b22f9130f25d7a67d454b6feef8e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Feb 2014 18:33:08 +0100 Subject: PlaylistSave: use DetachedSong::GetRealURI() in playlist_print_song() The DetachedSong instance already knows its own absolute path, and there is no need to ask the mapper again. --- src/PlaylistSave.cxx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx index 1e5094b18..62c27c96e 100644 --- a/src/PlaylistSave.cxx +++ b/src/PlaylistSave.cxx @@ -39,18 +39,13 @@ void playlist_print_song(FILE *file, const DetachedSong &song) { - if (playlist_saveAbsolutePaths && - song.IsInDatabase() && song.IsFile()) { - const auto path = map_song_fs(song); - if (!path.IsNull()) - fprintf(file, "%s\n", path.c_str()); - } else { - const auto uri_utf8 = song.GetURI(); - const auto uri_fs = AllocatedPath::FromUTF8(uri_utf8); - - if (!uri_fs.IsNull()) - fprintf(file, "%s\n", uri_fs.c_str()); - } + const char *uri_utf8 = playlist_saveAbsolutePaths + ? song.GetRealURI() + : song.GetURI(); + + const auto uri_fs = AllocatedPath::FromUTF8(uri_utf8); + if (!uri_fs.IsNull()) + fprintf(file, "%s\n", uri_fs.c_str()); } void -- cgit v1.2.3