aboutsummaryrefslogtreecommitdiffstats
path: root/src/update.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-13 16:46:32 +0200
committerMax Kellermann <max@duempel.org>2008-10-13 16:46:32 +0200
commit3e9ed15e76550f23233c7bb78ec1e609e6f2a0e3 (patch)
treeb82b9ca62e57fd2321cec80ce3533f7a52ce4156 /src/update.c
parent69617438a9658a2666c0e035529242f38aaf3399 (diff)
downloadmpd-3e9ed15e76550f23233c7bb78ec1e609e6f2a0e3.tar.gz
mpd-3e9ed15e76550f23233c7bb78ec1e609e6f2a0e3.tar.xz
mpd-3e9ed15e76550f23233c7bb78ec1e609e6f2a0e3.zip
update: added delete_name_in()
delete_name_in() is similar to delete_path(), but it does not need to look up the parent directory.
Diffstat (limited to '')
-rw-r--r--src/update.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c
index e07a32aff..52c87bbfd 100644
--- a/src/update.c
+++ b/src/update.c
@@ -123,6 +123,23 @@ delete_directory(struct directory *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 {
char *tmp;
struct directory *dir;
@@ -306,7 +323,7 @@ updateDirectory(struct directory *directory, const struct stat *st)
if (myStat(path_max_tmp, &st2) == 0)
updateInDirectory(directory, path_max_tmp, &st2);
else
- delete_path(path_max_tmp);
+ delete_name_in(directory, mpd_basename(path_max_tmp));
}
closedir(dir);