update: added delete_name_in()
delete_name_in() is similar to delete_path(), but it does not need to look up the parent directory.
This commit is contained in:
parent
69617438a9
commit
3e9ed15e76
19
src/update.c
19
src/update.c
@ -123,6 +123,23 @@ delete_directory(struct directory *directory)
|
|||||||
directory_free(directory);
|
directory_free(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
delete_name_in(struct directory *parent, const char *name)
|
||||||
|
{
|
||||||
|
struct directory *directory = directory_get_child(parent, name);
|
||||||
|
struct song *song = songvec_find(&parent->songs, name);
|
||||||
|
|
||||||
|
if (directory != NULL) {
|
||||||
|
delete_directory(directory);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (song != NULL) {
|
||||||
|
delete_song(parent, song);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct delete_data {
|
struct delete_data {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
struct directory *dir;
|
struct directory *dir;
|
||||||
@ -306,7 +323,7 @@ updateDirectory(struct directory *directory, const struct stat *st)
|
|||||||
if (myStat(path_max_tmp, &st2) == 0)
|
if (myStat(path_max_tmp, &st2) == 0)
|
||||||
updateInDirectory(directory, path_max_tmp, &st2);
|
updateInDirectory(directory, path_max_tmp, &st2);
|
||||||
else
|
else
|
||||||
delete_path(path_max_tmp);
|
delete_name_in(directory, mpd_basename(path_max_tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user