aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlaylistSave.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 18:33:08 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 18:42:16 +0100
commit3341b282b7e7b22f9130f25d7a67d454b6feef8e (patch)
treea9ebf17c0f474eb1eda009e6834e5f3bd14a8918 /src/PlaylistSave.cxx
parentbb3b836dbbd50c8a64aff23e55f5edf487ac6b0f (diff)
downloadmpd-3341b282b7e7b22f9130f25d7a67d454b6feef8e.tar.gz
mpd-3341b282b7e7b22f9130f25d7a67d454b6feef8e.tar.xz
mpd-3341b282b7e7b22f9130f25d7a67d454b6feef8e.zip
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.
Diffstat (limited to 'src/PlaylistSave.cxx')
-rw-r--r--src/PlaylistSave.cxx19
1 files changed, 7 insertions, 12 deletions
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