A quick, easy, and multi-threaded
method to poll file modification.
Unix: Yes Windows: Yes
include/
: fmon
headers
src/
: fmon
source code
LICENSE
: fmon
's GPL3 license
Makefile
: fmon
's very awesome and/or cool build file
compile_flags.txt
: config for clangd
Run $ fmon -
to monitor filenames from stdin.
Otherwise, run $ fmon [FILE]...
to monitor FILEs.
fmon
is now cross-platform.
When running make
, append -e "PLATFORM=[unix|windows]"
for the platform of your choice.
Run # make clean install
to install fmon
.
Run # make uninstall
to uninstall fmon
.
Add include/fmon.h
and src/fmon.cpp
to your project source.
Or run # make clean lib-install
to install the fmon
library.
Run # make lib-uninstall
to uninstall the fmon
library.
Make sure to the -lfmon
linker flag.
Example code:
#include <iostream> // std::cout
#include <stdexcept> // std::exception
#include <string> // std::string
#include <fmon.h> // FileMonitor
void foo(const char *file) {
// do stuff with `file`
// example:
std::cout << '\'' << file << "' was modified\n";
}
int main() {
FileMonitor fm(foo);
std::string file = ""; // your filename here
// for however many files
fm.files.push_back(file);
try {
fm.Main();
} catch(const std::exception& e) {
std::cerr << e.what() << '\n';
}
return 0;
}