mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibCore: Implement FileWatcher for Linux
This implements FileWatcher using inotify filesystem events. Serenity's InodeWatcher is remarkably similar to inotify, so this is almost an identical implementation. The existing TestLibCoreFileWatcher test is added to Lagom (currently just for Linux). This does not implement BlockingFileWatcher as that is currently not used anywhere but on Serenity.
This commit is contained in:
parent
91cbdc67de
commit
8ca528217c
4 changed files with 184 additions and 3 deletions
|
@ -28,10 +28,10 @@ TEST_CASE(file_watcher_child_events)
|
|||
file_watcher->on_change = [&](Core::FileWatcherEvent const& event) {
|
||||
if (event_count == 0) {
|
||||
EXPECT_EQ(event.event_path, "/tmp/testfile");
|
||||
EXPECT_EQ(event.type, Core::FileWatcherEvent::Type::ChildCreated);
|
||||
EXPECT(has_flag(event.type, Core::FileWatcherEvent::Type::ChildCreated));
|
||||
} else if (event_count == 1) {
|
||||
EXPECT_EQ(event.event_path, "/tmp/testfile");
|
||||
EXPECT_EQ(event.type, Core::FileWatcherEvent::Type::ChildDeleted);
|
||||
EXPECT(has_flag(event.type, Core::FileWatcherEvent::Type::ChildDeleted));
|
||||
|
||||
event_loop.quit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue