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.
This commit is contained in:
Max Kellermann 2010-04-13 23:37:44 +02:00
parent 393bcd961a
commit 8d631b346a

View File

@ -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)