| 36 | } |
| 37 | |
| 38 | DetachedSong |
| 39 | SongLoader::LoadFile(const char *path_utf8, Path path_fs) const |
| 40 | { |
| 41 | #ifdef ENABLE_DATABASE |
| 42 | if (storage != nullptr) { |
| 43 | const auto suffix = storage->MapToRelativeUTF8(path_utf8); |
| 44 | if (suffix.data() != nullptr) |
| 45 | /* this path was relative to the music |
| 46 | directory - obtain it from the database */ |
| 47 | return LoadFromDatabase(std::string(suffix).c_str()); |
| 48 | } |
| 49 | #endif |
| 50 | |
| 51 | DetachedSong song(path_utf8); |
| 52 | if (!song.LoadFile(path_fs)) |
| 53 | throw PlaylistError::NoSuchSong(); |
| 54 | |
| 55 | return song; |
| 56 | } |
| 57 | |
| 58 | DetachedSong |
| 59 | SongLoader::LoadSong(const LocatedUri &located_uri) const |
no test coverage detected