From 7ee1f99dd12e3d0b2cae02437a9457cab7cc6017 Mon Sep 17 00:00:00 2001 From: austin Date: Tue, 16 Jul 2024 14:45:40 -0400 Subject: [PATCH] script register ignorepath --- .../electrosphere/script/ScriptEngine.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/electrosphere/script/ScriptEngine.java b/src/main/java/electrosphere/script/ScriptEngine.java index e3ca6f27..82415766 100644 --- a/src/main/java/electrosphere/script/ScriptEngine.java +++ b/src/main/java/electrosphere/script/ScriptEngine.java @@ -59,6 +59,13 @@ public class ScriptEngine { "Scripts/compiler/host_access.js", }; + /** + * List of files that are ignored when registering new files + */ + static final String[] registerIgnores = new String[]{ + "/Scripts/compiler/host_access.ts", + }; + //The classes that will be provided to the scripting engine //https://stackoverflow.com/a/65942034 static final Object[][] staticClasses = new Object[][]{ @@ -227,8 +234,18 @@ public class ScriptEngine { if(dependentFilesCount > 0){ for(int i = 0; i < dependentFilesCount; i++){ String dependentFilePath = dependentFilesValue.getArrayElement(i).asString(); - LoggerInterface.loggerScripts.INFO("[HOST - Script Engine] Should register file " + dependentFilePath); - registerFile(dependentFilePath); + boolean shouldRegister = true; + for(String ignorePath : registerIgnores){ + if(ignorePath.equals(dependentFilePath)){ + shouldRegister = false; + } + } + if(shouldRegister){ + LoggerInterface.loggerScripts.INFO("[HOST - Script Engine] Should register file " + dependentFilePath); + registerFile(dependentFilePath); + } else { + LoggerInterface.loggerScripts.DEBUG("[HOST - Script Engine] Skipping ignorepath file " + dependentFilePath); + } } } } catch (IOException e) {