twn_filewatch.c: file and directory change api, initial support for texture reload

This commit is contained in:
veclavtalica
2025-01-29 07:21:09 +03:00
parent 630c6fb5d4
commit 4b2a22bf3c
7 changed files with 246 additions and 29 deletions

23
src/twn_filewatch_c.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef TWN_FILEWATCH_C_H
#define TWN_FILEWATCH_C_H
#include <stdbool.h>
#define FILEWATCH_MODIFIED_TICKS_MERGED 10
enum FilewatchAction {
FILEWATCH_ACTION_FILE_NONE,
FILEWATCH_ACTION_FILE_CREATED,
FILEWATCH_ACTION_FILE_DELETED,
FILEWATCH_ACTION_FILE_MODIFIED,
};
typedef void (*FileatchCallback)(char const *path, enum FilewatchAction action);
bool filewatch_add_directory(char *dir, FileatchCallback callback);
bool filewatch_add_file(char *file, FileatchCallback callback);
void filewatch_poll(void);
#endif