Watcher是一个文件监控工具,非常高效,即使扫描数千条路径,这个库使用的资源几乎可以忽略不计。
快速开始编写:
/*tiny-main.cpp*/#include<iostream>#include"../sinclude/watcher/watcher.hpp"/*Pointthistowhereveryoursis*/intmain(intargc,char**argv){usingnamespacewater::watcher;returnwatch(argc>1?argv[1]:".",[](constevent::event&this_event){std::cout<<this_event<<','<<std::endl;});}编译和运行:
#Step1:Biglongpath.Whatcanyoudo.PLATFORM_EXTRAS=$(test"$(uname)"=Darwin\&&echo'-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk-frameworkCoreFoundation-frameworkCoreServices')#Step2:Makethething.evalc++-std=c++2a-O3src/tiny-main.cpp-owatcher$PLATFORM_EXTRAS#Step3:Runthething../watcher#Alternatively:build/buildthisreleasetiny特性:简单高效无依赖性可在任何地方运行只有header文件
评论