db/update/Walk: move PurgeDanglingFromPlaylists() to Playlist.cxx
This commit is contained in:
parent
b82b56970b
commit
f7622ca332
@ -126,3 +126,25 @@ UpdateWalk::UpdatePlaylistFile(Directory &directory,
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UpdateWalk::PurgeDanglingFromPlaylists(Directory &directory) noexcept
|
||||||
|
{
|
||||||
|
/* recurse */
|
||||||
|
for (Directory &child : directory.children)
|
||||||
|
PurgeDanglingFromPlaylists(child);
|
||||||
|
|
||||||
|
if (!directory.IsPlaylist())
|
||||||
|
/* this check is only for virtual directories
|
||||||
|
representing a playlist file */
|
||||||
|
return;
|
||||||
|
|
||||||
|
directory.ForEachSongSafe([&](Song &song){
|
||||||
|
if (!song.target.empty() &&
|
||||||
|
!PathTraitsUTF8::IsAbsoluteOrHasScheme(song.target.c_str()) &&
|
||||||
|
!directory.TargetExists(song.target)) {
|
||||||
|
editor.DeleteSong(directory, &song);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -132,28 +132,6 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UpdateWalk::PurgeDanglingFromPlaylists(Directory &directory) noexcept
|
|
||||||
{
|
|
||||||
/* recurse */
|
|
||||||
for (Directory &child : directory.children)
|
|
||||||
PurgeDanglingFromPlaylists(child);
|
|
||||||
|
|
||||||
if (!directory.IsPlaylist())
|
|
||||||
/* this check is only for virtual directories
|
|
||||||
representing a playlist file */
|
|
||||||
return;
|
|
||||||
|
|
||||||
directory.ForEachSongSafe([&](Song &song){
|
|
||||||
if (!song.target.empty() &&
|
|
||||||
!PathTraitsUTF8::IsAbsoluteOrHasScheme(song.target.c_str()) &&
|
|
||||||
!directory.TargetExists(song.target)) {
|
|
||||||
editor.DeleteSong(directory, &song);
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static bool
|
static bool
|
||||||
update_directory_stat(Storage &storage, Directory &directory) noexcept
|
update_directory_stat(Storage &storage, Directory &directory) noexcept
|
||||||
|
Loading…
Reference in New Issue
Block a user