diff options
author | Max Kellermann <max@duempel.org> | 2010-04-13 23:37:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-04-13 23:37:44 +0200 |
commit | 8d631b346ade8a56490bfb7b73fa9d59e0ee2cd6 (patch) | |
tree | c7c05541cef32979bc544fdcfd24026ae1bc6dc6 | |
parent | 393bcd961ab750b2fdeba03e18f16b39ac82d38a (diff) | |
download | mpd-8d631b346ade8a56490bfb7b73fa9d59e0ee2cd6.tar.gz mpd-8d631b346ade8a56490bfb7b73fa9d59e0ee2cd6.tar.xz mpd-8d631b346ade8a56490bfb7b73fa9d59e0ee2cd6.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/inotify_update.c | 8 |
1 files changed, 6 insertions, 2 deletions
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) |