Skip to content

lvlrk/fmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fmon-1.4

A quick, easy, and multi-threaded
method to poll file modification.

Supported systems

Unix: Yes Windows: Yes

Patch notes

v1.0: initial version

v1.1: removed debug conditions

v1.2: added i686 support, + small bug fixes

v1.3: removed 1686 support, added windows support

v1.4: stat may not always throw exceptions :D

Project structure

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

Program usage

Run $ fmon - to monitor filenames from stdin.
Otherwise, run $ fmon [FILE]... to monitor FILEs.

Make notes

fmon is now cross-platform.
When running make, append -e "PLATFORM=[unix|windows]"
for the platform of your choice.

Installation

Run # make clean install to install fmon.

Uninstallation

Run # make uninstall to uninstall fmon.

Library usage

Add include/fmon.h and src/fmon.cpp to your project source.

Library Installation

Or run # make clean lib-install to install the fmon library.

Library Uninstallation

Run # make lib-uninstall to uninstall the fmon library.

Note:

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;
}

lvlrk 2023

About

A quick, easy, and multi-threaded method to poll file modification

Resources

License

Stars

Watchers

Forks

Packages

No packages published