[jsscripting] Update docs and refactor path (#11827)

This adds a minor refactoring of loading local resource paths that i didn't have time to get into 3.2  and moves the docs directory to doc.

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham
2021-12-21 14:36:22 -08:00
committed by GitHub
parent 6420533d68
commit ec10dfe897
6 changed files with 6 additions and 5 deletions

View File

@@ -223,11 +223,12 @@ public class OpenhabGraalJSScriptEngine extends InvocationInterceptingScriptEngi
/**
* Converts a root node path to a class resource path for loading local modules
* Ex: C:\node_modules\foo.js -> /node_modules/foo.js
*
* @param path
* @return
*/
private String nodeFileToResource(Path path) {
return "/" + NODE_DIR + "/" + path.getFileName();
return "/" + path.subpath(0, path.getNameCount()).toString().replace('\\', '/');
}
}