You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
751 B
32 lines
751 B
#include "watcher.hpp"
|
|
#include <filesystem>
|
|
|
|
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;
|
|
}
|
|
|