]> git.basschouten.com Git - openhab-addons.git/commitdiff
[jsscripting] Support non unix file paths (#11804)
authorDan Cunningham <dan@digitaldan.com>
Fri, 17 Dec 2021 16:08:35 +0000 (08:08 -0800)
committerGitHub <noreply@github.com>
Fri, 17 Dec 2021 16:08:35 +0000 (17:08 +0100)
Fixes #11801

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java

index d9a9e60916f10b586da04a429a927ae13f532a13..c3bdce81a46b43d98e9a6afcd894ae8da30e67fb 100644 (file)
@@ -14,6 +14,7 @@ package org.openhab.automation.jsscripting.internal;
 
 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;