#include "watcher.hpp" #include using std::string; namespace fs = std::filesystem; void UpdateListener::handleFileAction(efsw::WatchID watchid, const string& dir, const string& filename, efsw::Action action, string oldFilename) { // this is some gnarly BS here, probably tons // of memory leaks for now but it's working int ignored = 1; auto the_path = fs::path(dir) / fs::path(filename); string full_path = the_path.lexically_normal().string(); std::replace(full_path.begin(), full_path.end(), '\\', '/'); int rc = git_ignore_path_is_ignored(&ignored, repo, full_path.c_str()); if(!ignored) { changes = changes || !ignored; } } void UpdateListener::reset_state() { changes = false; }