libsaria: Switch the update code to use the new list
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
250a8b9bfe
commit
a7d1f57403
|
@ -3,6 +3,7 @@
|
|||
#include <libsaria/track.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/deck.h>
|
||||
#include <libsaria/list.h>
|
||||
#include <libsaria/idle.h>
|
||||
#include <libsaria/fs.h>
|
||||
#include "library.h"
|
||||
|
@ -34,21 +35,18 @@ ValidateTask::~ValidateTask()
|
|||
|
||||
void ValidateTask::run_task()
|
||||
{
|
||||
list<libsaria::Track> to_rm;
|
||||
list<libsaria::Track>::iterator it, it_mv;
|
||||
libsaria::Track *track;
|
||||
libsaria::ListItem<libsaria::Track> *it;
|
||||
|
||||
for (it = path->tracks.begin(); it != path->tracks.end(); it++) {
|
||||
if (!libsaria::exists(it->get_filepath())) {
|
||||
println("Reaping: " + it->get_filepath());
|
||||
/* Iterators are no longer valid after splice */
|
||||
it_mv = it;
|
||||
it--;
|
||||
to_rm.splice(to_rm.begin(), path->tracks, it_mv);
|
||||
for (it = path->_tracks.first(); it != path->_tracks.end(); it = it->next()) {
|
||||
track = &it->get_value();
|
||||
if (!libsaria::exists(track->get_filepath())) {
|
||||
println("Reaping: " + track->get_filepath());
|
||||
it = path->_tracks.erase(it);
|
||||
path->data_state = DIRTY;
|
||||
}
|
||||
};
|
||||
|
||||
libsaria::deck::tracks_removed(to_rm);
|
||||
notify_path_updated(path);
|
||||
save_path(path);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue