!7 module RecursiveFileWatchServiceSpike > DynPrintLog { switchable File dir; switchable bool verbose; transient bool started; start { if (dir == null) dir = javaxDataDir(); thread "Starting" { print("Starting watch service on " + dir); WatchService watchService = jdk_watchService_start(); jdk_watchService_registerRecursivePath(dir, voidfunc(File f) enter { if (verbose) print("File changed: " + f); vmBus_send('fileChanged, f); }); print("Listening to changes in " + dir); started = true; } } }