diff options
Diffstat (limited to 'Libraries/LibGUI/GDirectoryModel.cpp')
-rw-r--r-- | Libraries/LibGUI/GDirectoryModel.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibGUI/GDirectoryModel.cpp b/Libraries/LibGUI/GDirectoryModel.cpp index b682f9bf7e..be68c4dd7e 100644 --- a/Libraries/LibGUI/GDirectoryModel.cpp +++ b/Libraries/LibGUI/GDirectoryModel.cpp @@ -308,7 +308,18 @@ void GDirectoryModel::open(const StringView& a_path) if (!dirp) return; closedir(dirp); + if (m_notifier) + close(m_notifier->fd()); m_path = path; + int watch_fd = watch_file(path.characters(), path.length()); + if (watch_fd < 0) { + perror("watch_file"); + ASSERT_NOT_REACHED(); + } + m_notifier = make<CNotifier>(watch_fd, CNotifier::Event::Read); + m_notifier->on_ready_to_read = [this] { + update(); + }; update(); set_selected_index(index(0, 0)); } |