From ff9b405e73d87a7d5dd6fde1f43b38c3c0b80ee8 Mon Sep 17 00:00:00 2001 From: Dan Cunningham Date: Fri, 17 Dec 2021 08:08:35 -0800 Subject: [PATCH] [jsscripting] Support non unix file paths (#11804) Fixes #11801 Signed-off-by: Dan Cunningham Signed-off-by: Nick Waterton --- .../jsscripting/internal/OpenhabGraalJSScriptEngine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java b/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java index d9a9e60916f10..c3bdce81a46b4 100644 --- a/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java +++ b/bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java @@ -14,6 +14,7 @@ import static org.openhab.core.automation.module.script.ScriptEngineFactory.*; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.channels.SeekableByteChannel; @@ -65,7 +66,7 @@ public class OpenhabGraalJSScriptEngine extends InvocationInterceptingScriptEngi private static final String GLOBAL_REQUIRE = "require(\"@jsscripting-globals\");"; private static final String REQUIRE_WRAPPER_NAME = "__wraprequire__"; // final CommonJS search path for our library - private static final Path LOCAL_NODE_PATH = Paths.get("/node_modules"); + private static final Path LOCAL_NODE_PATH = Paths.get(File.separator + "node_modules"); // these fields start as null because they are populated on first use private @NonNullByDefault({}) String engineIdentifier;