资 源 简 介
SimpleFileWatcher is a C++ wrapper for OS file monitoring systems. Currently
it uses Win32 ReadDirectoryChangesW for monitoring changes in Windows,
and inotify in linux. OSX is supported via kqueue and directory scans.
Some example code:
```
// Create the object
FW::FileWatcher* fileWatcher = new FW::FileWatcher();
// add a directory watch
FW::WatchID watchid = fileWatcher->addWatch("..\media", new UpdateListener());
...
// somewhere in your update loop call update
fileWatcher->update();
// where UpdateListener is defined as such
class UpdateListener : public FW::FileWatchListener
{
public:
UpdateListener() {}
void handleFileAction(FW::WatchID watchid, const String& dir, const String& filename,
FW::Action action)
{
switch(action)
{
case FW::Actions::Add:
std::cout << "File (" << dir + "\" + filename << ") Added! " << std::endl