From ccc767618c032cf51b0cabe872fff8fd30ba451a Mon Sep 17 00:00:00 2001 From: austin Date: Mon, 14 Apr 2025 17:03:26 -0400 Subject: [PATCH] comment out script engine file watching --- docs/src/progress/renderertodo.md | 1 + .../electrosphere/script/ScriptEngine.java | 76 +++++++++---------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index eb4cf4f8..7bfed2ec 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1472,6 +1472,7 @@ Voxel type work (04/14/2025) Inventory sounds for some materials Inventory audio work +Comment out script engine file watching for testing purposes diff --git a/src/main/java/electrosphere/script/ScriptEngine.java b/src/main/java/electrosphere/script/ScriptEngine.java index 428910d4..c90f621a 100644 --- a/src/main/java/electrosphere/script/ScriptEngine.java +++ b/src/main/java/electrosphere/script/ScriptEngine.java @@ -142,27 +142,27 @@ public class ScriptEngine extends SignalServiceImpl { } ); sourceMap = new HashMap(); - this.fs = FileSystems.getDefault(); - try { - this.watchService = fs.newWatchService(); - } catch (IOException e) { - LoggerInterface.loggerFileIO.ERROR(e); - } - //register all source directories - try { - Files.walkFileTree(new File(TS_SOURCE_DIR).toPath(), new SimpleFileVisitor(){ - @Override - public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attr) throws IOException { - dir.register( - watchService, - new WatchEvent.Kind[]{StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE} - ); - return FileVisitResult.CONTINUE; - } - }); - } catch (IOException e) { - LoggerInterface.loggerEngine.ERROR(e); - } + // this.fs = FileSystems.getDefault(); + // try { + // this.watchService = fs.newWatchService(); + // } catch (IOException e) { + // LoggerInterface.loggerFileIO.ERROR(e); + // } + // //register all source directories + // try { + // Files.walkFileTree(new File(TS_SOURCE_DIR).toPath(), new SimpleFileVisitor(){ + // @Override + // public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attr) throws IOException { + // dir.register( + // watchService, + // new WatchEvent.Kind[]{StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE} + // ); + // return FileVisitResult.CONTINUE; + // } + // }); + // } catch (IOException e) { + // LoggerInterface.loggerEngine.ERROR(e); + // } } /** @@ -193,23 +193,23 @@ public class ScriptEngine extends SignalServiceImpl { * Scans the scripts directory for updates */ public void scanScriptDir(){ - WatchKey key = null; - while((key = watchService.poll()) != null){ - List> events = key.pollEvents(); - for(WatchEvent event : events){ - if(event.kind() == StandardWatchEventKinds.ENTRY_MODIFY){ - if(event.context() instanceof Path){ - // Path filePath = (Path)event.context(); - // System.out.println(filePath); - } - } else if(event.kind() == StandardWatchEventKinds.ENTRY_CREATE){ - throw new Error("Cannot handle create events yet"); - } else if(event.kind() == StandardWatchEventKinds.ENTRY_DELETE){ - throw new Error("Cannot handle delete events yet"); - } - } - key.reset(); - } + // WatchKey key = null; + // while((key = watchService.poll()) != null){ + // List> events = key.pollEvents(); + // for(WatchEvent event : events){ + // if(event.kind() == StandardWatchEventKinds.ENTRY_MODIFY){ + // if(event.context() instanceof Path){ + // // Path filePath = (Path)event.context(); + // // System.out.println(filePath); + // } + // } else if(event.kind() == StandardWatchEventKinds.ENTRY_CREATE){ + // throw new Error("Cannot handle create events yet"); + // } else if(event.kind() == StandardWatchEventKinds.ENTRY_DELETE){ + // throw new Error("Cannot handle delete events yet"); + // } + // } + // key.reset(); + // } } /**