diff options
author | Max Kellermann <max@duempel.org> | 2014-01-07 21:39:47 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-09 09:05:58 +0100 |
commit | 322b0616322760dc162447563d8f4da7e024ca90 (patch) | |
tree | 2f87cb3ce061556161797aba9f57ee08de5b9e21 /src/Mapper.cxx | |
parent | 43847f2244a34064af24704aac4cfad4a3c76f7d (diff) |
DetachedSong: fork of struct Song
From now on, struct Song will be used by the database only, and
DetachedSong will be used by everybody else. DetachedSong is easier
to use, but Song has lower overhead.
Diffstat (limited to 'src/Mapper.cxx')
-rw-r--r-- | src/Mapper.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx index fbe1e8c34..6910b4983 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -25,6 +25,7 @@ #include "Mapper.hxx" #include "Directory.hxx" #include "Song.hxx" +#include "DetachedSong.hxx" #include "fs/AllocatedPath.hxx" #include "fs/Traits.hxx" #include "fs/Charset.hxx" @@ -219,14 +220,18 @@ map_detached_song_fs(const char *uri_utf8) AllocatedPath map_song_fs(const Song &song) { - assert(song.IsFile()); + return song.parent == nullptr + ? map_detached_song_fs(song.uri) + : map_directory_child_fs(*song.parent, song.uri); +} - if (song.IsInDatabase()) - return song.IsDetached() - ? map_detached_song_fs(song.uri) - : map_directory_child_fs(*song.parent, song.uri); +AllocatedPath +map_song_fs(const DetachedSong &song) +{ + if (song.IsAbsoluteFile()) + return AllocatedPath::FromUTF8(song.GetURI()); else - return AllocatedPath::FromUTF8(song.uri); + return map_uri_fs(song.GetURI()); } std::string |