diff --git a/headers/private/storage/AddOnMonitorHandler.h b/headers/private/storage/AddOnMonitorHandler.h index b7efc675c1..7902f8254e 100644 --- a/headers/private/storage/AddOnMonitorHandler.h +++ b/headers/private/storage/AddOnMonitorHandler.h @@ -40,7 +40,10 @@ public: // Note that directories are not watched recursively, and all entries // are reported as add-ons regardless of their node type (files, // directories, symlinks). - virtual status_t AddDirectory(const node_ref* nref); + // If sync is true all pending add-on entries are handled immediately. + // Including entries from other directories. + virtual status_t AddDirectory(const node_ref* nref, + bool sync = false); protected: // hooks for sub-class @@ -66,7 +69,7 @@ protected: virtual void StatChanged(ino_t node, dev_t device); private: - void _HandlePulse(); + void _HandlePendingEntries(); void _EntryCreated(add_on_entry_info& info); typedef NodeMonitorHandler inherited; diff --git a/src/kits/storage/AddOnMonitorHandler.cpp b/src/kits/storage/AddOnMonitorHandler.cpp index 897aaa7bf0..d6a167e52d 100644 --- a/src/kits/storage/AddOnMonitorHandler.cpp +++ b/src/kits/storage/AddOnMonitorHandler.cpp @@ -47,14 +47,14 @@ void AddOnMonitorHandler::MessageReceived(BMessage* msg) { if (msg->what == B_PULSE) - _HandlePulse(); + _HandlePendingEntries(); inherited::MessageReceived(msg); } status_t -AddOnMonitorHandler::AddDirectory(const node_ref* nref) +AddOnMonitorHandler::AddDirectory(const node_ref* nref, bool sync) { // Keep the looper thread locked, since this method is likely to be called // in a thread other than the looper thread. Otherwise we may access the @@ -98,6 +98,9 @@ AddOnMonitorHandler::AddDirectory(const node_ref* nref) fPendingEntries.push_back(entryInfo); } + if (sync) + _HandlePendingEntries(); + return B_OK; } @@ -441,7 +444,7 @@ AddOnMonitorHandler::StatChanged(ino_t node, dev_t device) //! Process pending entries. void -AddOnMonitorHandler::_HandlePulse() +AddOnMonitorHandler::_HandlePendingEntries() { BDirectory directory; EntryList::iterator iter = fPendingEntries.begin();