From 8d631b346ade8a56490bfb7b73fa9d59e0ee2cd6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 13 Apr 2010 23:37:44 +0200 Subject: inotify_update: start update when directory is created This is useful at the maximum depth level, to update newly created directories. It is however questionable if the hard-coded 5 seconds delay is enough to create new directory trees with all of their files, but we might make that delay configurable in the future. --- src/inotify_update.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/inotify_update.c b/src/inotify_update.c index 1148ebe31..218440110 100644 --- a/src/inotify_update.c +++ b/src/inotify_update.c @@ -275,8 +275,12 @@ mpd_inotify_callback(int wd, unsigned mask, g_free(path_fs); } - if ((mask & (IN_CLOSE_WRITE|IN_MOVE|IN_DELETE)) != 0) { - /* a file was changed, or a direectory was + if ((mask & (IN_CLOSE_WRITE|IN_MOVE|IN_DELETE)) != 0 || + /* at the maximum depth, we watch out for newly created + directories */ + (watch_directory_depth(directory) == inotify_max_depth && + (mask & (IN_CREATE|IN_ISDIR)) == (IN_CREATE|IN_ISDIR))) { + /* a file was changed, or a directory was moved/deleted: queue a database update */ char *uri_utf8 = uri_fs != NULL ? fs_charset_to_utf8(uri_fs) -- cgit v1.2.3