diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx index 3b475627f..896e331b7 100644 --- a/src/db/plugins/simple/Directory.cxx +++ b/src/db/plugins/simple/Directory.cxx @@ -27,6 +27,7 @@ #include "db/Uri.hxx" #include "db/DatabaseLock.hxx" #include "db/Interface.hxx" +#include "db/Selection.hxx" #include "song/Filter.hxx" #include "lib/icu/Collate.hxx" #include "fs/Traits.hxx" @@ -227,7 +228,7 @@ Directory::Walk(bool recursive, const SongFilter *filter, call will lock it again */ const ScopeDatabaseUnlock unlock; WalkMount(GetPath(), *mounted_database, - "", recursive, filter, + "", DatabaseSelection("", recursive, filter), visit_directory, visit_song, visit_playlist); return; diff --git a/src/db/plugins/simple/Mount.cxx b/src/db/plugins/simple/Mount.cxx index d1c694adb..af7d7657a 100644 --- a/src/db/plugins/simple/Mount.cxx +++ b/src/db/plugins/simple/Mount.cxx @@ -66,7 +66,8 @@ PrefixVisitPlaylist(const char *base, const VisitPlaylist &visit_playlist, void WalkMount(const char *base, const Database &db, - const char* uri, bool recursive, const SongFilter *filter, + const char *uri, + const DatabaseSelection &old_selection, const VisitDirectory &visit_directory, const VisitSong &visit_song, const VisitPlaylist &visit_playlist) { @@ -87,16 +88,19 @@ WalkMount(const char *base, const Database &db, vp = std::bind(PrefixVisitPlaylist, base, std::ref(visit_playlist), _1, _2); + DatabaseSelection selection(old_selection); + selection.uri = uri; + SongFilter prefix_filter; - if (base != nullptr && filter != nullptr) { + if (base != nullptr && selection.filter != nullptr) { /* if the SongFilter contains a LOCATE_TAG_BASE_TYPE item, copy the SongFilter and drop the mount point from the filter, because the mounted database doesn't know its own location within MPD's VFS */ - prefix_filter = filter->WithoutBasePrefix(base); - filter = &prefix_filter; + prefix_filter = selection.filter->WithoutBasePrefix(base); + selection.filter = &prefix_filter; } - db.Visit(DatabaseSelection(uri, recursive, filter), vd, vs, vp); + db.Visit(selection, vd, vs, vp); } diff --git a/src/db/plugins/simple/Mount.hxx b/src/db/plugins/simple/Mount.hxx index c79e52354..a82a232ef 100644 --- a/src/db/plugins/simple/Mount.hxx +++ b/src/db/plugins/simple/Mount.hxx @@ -23,11 +23,12 @@ #include "db/Visitor.hxx" class Database; -class SongFilter; +struct DatabaseSelection; void WalkMount(const char *base, const Database &db, - const char* uri, bool recursive, const SongFilter *filter, + const char *uri, + const DatabaseSelection &old_selection, const VisitDirectory &visit_directory, const VisitSong &visit_song, const VisitPlaylist &visit_playlist); diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 4d5601f63..f4c766288 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -280,8 +280,8 @@ SimpleDatabase::Visit(const DatabaseSelection &selection, protect.unlock(); WalkMount(r.directory->GetPath(), *(r.directory->mounted_database), - (r.uri == nullptr)?"":r.uri, selection.recursive, selection.filter, - visit_directory, visit_song, visit_playlist); + (r.uri == nullptr)?"":r.uri, selection, + visit_directory, visit_song, visit_playlist); return; }