Fixed dirwatch dummy, and scanning.

This commit is contained in:
Adam Harrison 2022-05-09 21:30:13 -04:00
parent d8436d1e92
commit ddc3a8842b
2 changed files with 8 additions and 7 deletions

View File

@ -97,8 +97,9 @@ function dirwatch:check(change_callback, scan_time, wait_time)
local start_time = system.get_time()
for directory, old_modified in pairs(self.scanned) do
if old_modified then
local new_modified = system.get_file_info(directory).modified
if old_modified < new_modified then
local info = system.get_file_info(directory)
local new_modified = info and info.modified
if old_modified ~= new_modified then
change_callback(directory)
had_change = true
self.scanned[directory] = new_modified

View File

@ -1,8 +1,8 @@
#include <stdlib.h>
struct dirmonitor_internal* init_dirmonitor() { return NULL; }
void deinit_dirmonitor(struct dirmonitor_internal*) { }
int get_changes_dirmonitor(struct dirmonitor_internal*, char*, size_t) { return -1; }
int translate_changes_dirmonitor(struct dirmonitor_internal*, char*, int, int (*)(int, const char*, void*), void*) { return -1; }
int add_dirmonitor(struct dirmonitor_internal*, const char*) { return -1; }
void remove_dirmonitor(struct dirmonitor_internal*, int) { }
void deinit_dirmonitor(struct dirmonitor_internal* monitor) { }
int get_changes_dirmonitor(struct dirmonitor_internal* monitor, char* buffer, size_t len) { return -1; }
int translate_changes_dirmonitor(struct dirmonitor_internal* monitor, char* buffer, int size, int (*callback)(int, const char*, void*), void* data) { return -1; }
int add_dirmonitor(struct dirmonitor_internal* monitor, const char* path) { return -1; }
void remove_dirmonitor(struct dirmonitor_internal* monitor, int fd) { }