diff --git a/src/database.c b/src/database.c index 6d7cc3e23..d93066389 100644 --- a/src/database.c +++ b/src/database.c @@ -128,6 +128,10 @@ db_walk(const char *uri, return false; } + if (visitor->directory != NULL && + !visitor->directory(directory, ctx, error_r)) + return false; + return directory_walk(directory, visitor, ctx, error_r); } diff --git a/src/directory.c b/src/directory.c index 515b07e7d..83fefb8c4 100644 --- a/src/directory.c +++ b/src/directory.c @@ -177,10 +177,6 @@ directory_walk(struct directory *directory, assert(visitor != NULL); assert(error_r == NULL || *error_r == NULL); - if (visitor->directory != NULL && - !visitor->directory(directory, ctx, error_r)) - return false; - if (visitor->song != NULL) { struct songvec *sv = &directory->songs; for (size_t i = 0; i < sv->nr; ++i) @@ -192,6 +188,10 @@ directory_walk(struct directory *directory, for (size_t i = 0; i < dv->nr; ++i) { struct directory *child = dv->base[i]; + if (visitor->directory != NULL && + !visitor->directory(child, ctx, error_r)) + return false; + if (!directory_walk(child, visitor, ctx, error_r)) return false; }