aboutsummaryrefslogtreecommitdiff
path: root/src/hotload.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hotload.h')
-rw-r--r--src/hotload.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/hotload.h b/src/hotload.h
index 78ed07b..7f11f6d 100644
--- a/src/hotload.h
+++ b/src/hotload.h
@@ -7,6 +7,19 @@
#define HOTLOADER_CALLBACK(name) void name(char *absolutepath, char *directory, char *filename)
typedef HOTLOADER_CALLBACK(hotloader_callback);
+enum watch_kind
+{
+ WATCH_KIND_INVALID,
+ WATCH_KIND_CATALOG,
+ WATCH_KIND_FILE
+};
+
+struct watched_catalog
+{
+ char *directory;
+ char *extension;
+}
+
struct watched_file
{
char *absolutepath;
@@ -14,6 +27,15 @@ struct watched_file
char *filename;
};
+struct watched_entry
+{
+ enum watch_kind kind;
+ union {
+ struct watched_file file_info;
+ struct watched_catalog catalog_info;
+ };
+};
+
struct hotloader
{
FSEventStreamEventFlags flags;
@@ -22,12 +44,13 @@ struct hotloader
bool enabled;
hotloader_callback *callback;
- struct watched_file watch_list[32];
+ struct watched_entry watch_list[32];
unsigned watch_count;
};
bool hotloader_begin(struct hotloader *hotloader, hotloader_callback *callback);
void hotloader_end(struct hotloader *hotloader);
+void hotloader_add_catalog(struct hotloader *hotloader, char *directory, char *extension);
void hotloader_add_file(struct hotloader *hotloader, char *file);
#endif