Created
November 13, 2015 03:30
-
-
Save trentbrooks/d6c63496b28b2ce1b11b to your computer and use it in GitHub Desktop.
OF/Poco directory watcher minimal example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ofApp.h | |
#include "Poco/DirectoryWatcher.h" | |
#include "Poco/Delegate.h" | |
Poco::DirectoryWatcher* watcher; | |
void onFileAdded(const Poco::DirectoryWatcher::DirectoryEvent& addEvent); | |
void onFileChanged(const Poco::DirectoryWatcher::DirectoryEvent& changeEvent); | |
// ofApp.cpp | |
watcher = new Poco::DirectoryWatcher(ofToDataPath("img")); | |
watcher->itemAdded += Poco::delegate(this, &ofApp::onFileAdded); | |
watcher->itemModified += Poco::delegate(this, &ofApp::onFileChanged); | |
void ofApp::onFileAdded(const Poco::DirectoryWatcher::DirectoryEvent& addEvent) { | |
ofLog() << "Added: " << addEvent.item.path(); | |
} | |
void ofApp::onFileChanged(const Poco::DirectoryWatcher::DirectoryEvent& changeEvent) { | |
ofLog() << "Changed: " << addEvent.item.path(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment