-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
Description
It is a common pattern to add a watch to files or folders which were created. Currently, it is possible to watch these files by a bit complicated code shown in a test case. To simplify the code one could add the following method to the NotifierBuilder:
auto notifier = BuildNotifier()
.watchPathRecursively(testDirectory_)
.onEventWatchPathRecursively(Event::create | Event::isDir);
.onEventWatchFile(Event::create);or maybe with predefined actions. It would keep the API more clean. But overloading the method is not good practice. So give it a new name e.g.: onEventDoPredefinedAction ? (to long IMHO)
auto notifier = BuildNotifier()
.watchPathRecursively(testDirectory_)
.onEvent(Event::create, Action::watchFile);
.onEvent(Event::create | Event::isDir, Action::watchPath); // same as watchFile but more convenient
.onEvent(Event::create | Event::isDir, Action::watchPathRecursively);
});