FileSystemWatcher example
#include <AsyncFw/FileSystemWatcher>
#include <AsyncFw/File>
#include <AsyncFw/MainThread>
#include <AsyncFw/LogStream>
using namespace AsyncFw;
int main(int argc, char *argv[]) {
#ifdef USE_QAPPLICATION
QCoreApplication app(argc, argv);
#endif
watcher.
notify([](
const std::string &name,
int event) {
lsInfoMagenta() << "file:" << name << event;
MainThread::exit();
});
File _f {
"/tmp/FileSystemWatcher.example"};
if (_f.exists()) _f.
remove();
else { _f.open(std::ios::binary | std::ios::out); };
lsInfoGreen() << watcher;
lsNotice() << "Start Applicaiton";
int ret = MainThread::exec();
lsNotice() << "End Applicaiton" << ret;
return ret;
}
The FileSystemWatcher class.
Definition FileSystemWatcher.h:17
FunctionConnectorProtected< FileSystemWatcher >::Connector< const std::string &, int > notify
The FunctionConnector for notification of file-related events.
Definition FileSystemWatcher.h:31
The File class.
Definition File.h:16