This commit is contained in:
veclavtalica
2025-01-30 05:10:38 +03:00
parent 74d7190c62
commit 7074e7499a
5 changed files with 13 additions and 5 deletions

View File

@ -29,6 +29,8 @@ static void filewatch_callback(dmon_watch_id watch_id,
const char* oldfilepath,
void* user)
{
(void)watch_id; (void)rootdir; (void)filepath; (void)oldfilepath;
enum FilewatchAction faction;
switch (action) {
@ -41,6 +43,7 @@ static void filewatch_callback(dmon_watch_id watch_id,
case DMON_ACTION_MODIFY:
faction = FILEWATCH_ACTION_FILE_MODIFIED;
break;
case DMON_ACTION_MOVE:
default:
return;
}
@ -74,6 +77,8 @@ bool filewatch_add_directory(char const *dir, FileatchCallback callback) {
};
arrpush(filewatch_directories, w);
dmon_watch(dir, filewatch_callback, DMON_WATCHFLAGS_RECURSIVE, (void *)(intptr_t)(arrlen(filewatch_directories) - 1));
return true;
}
@ -91,6 +96,8 @@ bool filewatch_add_file(char const *filepath, FileatchCallback callback) {
};
arrpush(filewatch_files, f);
dmon_watch("./", filewatch_callback, 0, (void *)(intptr_t)(-arrlen(filewatch_files)));
return true;
}