#include #include #include #include static str TEST_FILE_PATH = al_str_c("./test.txt"); static struct nn_event_loop loop; static struct nn_fs_event fs; static void fs_event_callback(void *userdata, struct inotify_event *event) { (void)userdata; (void)event; al_printf("WRITE CLOSE\n"); nn_fs_event_stop(&fs); } s32 main(void) { if (!nn_common_init(NULL)) return EXIT_FAILURE; nn_event_loop_init(&loop); if (!nn_file_exists(&TEST_FILE_PATH)) { nn_file_create(&TEST_FILE_PATH); } nn_fs_event_init(&fs, &TEST_FILE_PATH, NNWT_FS_CLOSE_WRITE, fs_event_callback, NULL); if (!nn_fs_event_start(&fs, &loop)) { return EXIT_FAILURE; } al_printf("Do something like: \"echo 'yo' > test.txt\"\n"); nn_event_loop_run(&loop); nn_common_close(); return EXIT_SUCCESS; }