Cross platform C++ filesystem watcher

人盡茶涼 提交于 2019-12-06 12:12:47

Qt is divided into modules, so using this feature doesn't mean you have to use the GUI library.

QFileSystemWatcher is in QtCore, which has no GUI functionality.

I have not used this (I came to this question looking for alternatives), but http://code.google.com/p/simplefilewatcher seems to be a good option. It is not currently maintained, but the relevant APIs are probably fairly stable. I'll try to remember to update this answer if I use this library.

As an alternative there is also "Entropia File System Watcher"

https://bitbucket.org/SpartanJ/efsw which is a fork of the simple-file-watcher.

efsw currently supports the following platforms:

Linux via inotify

Windows via I/O Completion Ports

Mac OS X via FSEvents or kqueue

FreeBSD/BSD via kqueue

OS-independent generic watcher (polling the disk for directory snapshots and comparing them periodically)

If any of the backend fails to start by any reason, it will fallback to the OS-independent implementation.

For completeness sake, it is also worth mentioning Poco's DirectoryWatcher.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!