summaryrefslogtreecommitdiff
path: root/zen/dir_watcher.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:59 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:21:59 +0200
commitd4af25c52a28b93484ffb55e0a8027bc4ce7856f (patch)
tree853d57468d6b370711e7a5dd2c3dc7d5bac81b10 /zen/dir_watcher.h
parent5.8 (diff)
downloadFreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.gz
FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.tar.bz2
FreeFileSync-d4af25c52a28b93484ffb55e0a8027bc4ce7856f.zip
5.9
Diffstat (limited to 'zen/dir_watcher.h')
-rw-r--r--zen/dir_watcher.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/zen/dir_watcher.h b/zen/dir_watcher.h
index 56497040..b0df48bd 100644
--- a/zen/dir_watcher.h
+++ b/zen/dir_watcher.h
@@ -24,10 +24,10 @@ namespace zen
removal of top watched directory is NOT notified!
Windows: removal of top watched directory also NOT notified (e.g. brute force usb stick removal)
however manual unmount IS notified (e.g. usb stick removal, then re-insert), but watching is stopped!
- Renaming of top watched directory handled incorrectly: Not notified(!) + changes in subfolders
- report FILE_ACTION_MODIFIED for directory (check that should prevent this fails!)
+ Renaming of top watched directory handled incorrectly: Not notified(!) + additional changes in subfolders
+ now do report FILE_ACTION_MODIFIED for directory (check that should prevent this fails!)
- Overcome all issues portably: check existence of watched directory externally + reinstall watch after changes in directory structure (added directories) are possible
+ Overcome all issues portably: check existence of top watched directory externally + reinstall watch after changes in directory structure (added directories) are possible
*/
class DirWatcher
{
@@ -35,8 +35,24 @@ public:
DirWatcher(const Zstring& directory); //throw FileError, ErrorNotExisting
~DirWatcher();
+ enum ActionType
+ {
+ ACTION_CREATE,
+ ACTION_UPDATE,
+ ACTION_DELETE,
+ };
+
+ struct Entry
+ {
+ Entry() : action_(ACTION_CREATE) {}
+ Entry(ActionType action, const Zstring& filename) : action_(action), filename_(filename) {}
+
+ ActionType action_;
+ Zstring filename_;
+ };
+
//extract accumulated changes since last call
- std::vector<Zstring> getChanges(const std::function<void()>& processGuiMessages); //throw FileError
+ std::vector<Entry> getChanges(const std::function<void()>& processGuiMessages); //throw FileError
private:
DirWatcher(const DirWatcher&);
bgstack15