Watcher prototype » History » Revision 9
Revision 8 (Greg Burri, 08/04/2009 10:15 AM) → Revision 9/17 (Greg Burri, 08/04/2009 10:24 AM)
h1. Watcher prototype The cache file structure store all the hashes of the shared files. If a file is added or removed from a shared directory (or a subfolder) it should be added or removed from the cache. As far as I know there is no way to watch changes recursively of a folder tree with Qt. tree. The Qt QT class _QFileSystemWatcher_ cannot watch recursively. The only way to synchronize is to periodically scan all the shared data and compare to the cached one. It can be a bit CPU consumer so it should be done with a low priority thread and maybe with a pause between each file hashing. h2. Native solution A better solution would be to use native platform API. h3. Linux : inotify On Linux it exists a function called "inotify":http://linux.die.net/man/7/inotify h3. Windows : FindFirstChangeNotification On Windows a directory and its subtree can be watched, see : http://msdn.microsoft.com/en-us/library/aa365261%28VS.85%29.aspx There is a simple function called _ReadDirectoryChangesW_ : http://msdn.microsoft.com/en-us/library/aa365465%28VS.85%29.aspx