Cosmetics...

This commit is contained in:
Eric van der Vlist 2021-05-02 00:06:36 +02:00
parent f1060d6007
commit b62623370a
1 changed files with 7 additions and 6 deletions

View File

@ -6,7 +6,7 @@
*/ */
/* /*
* Shortcuts aka imports * Shortcuts (aka imports)
*/ */
out = Packages.java.lang.System.out; out = Packages.java.lang.System.out;
CommonsOperationsUtil = Packages.ro.sync.ecss.extensions.commons.operations.CommonsOperationsUtil; CommonsOperationsUtil = Packages.ro.sync.ecss.extensions.commons.operations.CommonsOperationsUtil;
@ -17,6 +17,7 @@ CommonsOperationsUtil = Packages.ro.sync.ecss.extensions.commons.operations.Comm
* *
*/ */
require = function (filepath) { require = function (filepath) {
// Check if the object has been initialized // Check if the object has been initialized
if (Object.keys(require).length == 0) { if (Object.keys(require).length == 0) {
var currentPath = CommonsOperationsUtil.expandAndResolvePath(authorAccess, 'commons.js'); var currentPath = CommonsOperationsUtil.expandAndResolvePath(authorAccess, 'commons.js');
@ -25,6 +26,7 @@ require = function (filepath) {
}; };
require.urisSet[currentPath] = true; require.urisSet[currentPath] = true;
} }
var currentFilePath = require.urisStack[require.urisStack.length - 1]; var currentFilePath = require.urisStack[require.urisStack.length - 1];
var currentURI = new java.net.URI(currentFilePath); var currentURI = new java.net.URI(currentFilePath);
var targetURI = currentURI.resolve(filepath); var targetURI = currentURI.resolve(filepath);
@ -34,10 +36,9 @@ require = function (filepath) {
require.urisSet[filepath] = true; require.urisSet[filepath] = true;
var uri = new java.net.URI(filepath); var uri = new java.net.URI(filepath);
out.println('Including ' + uri.toString()); out.println('Including ' + uri.toString());
var text = new java.lang.String(java.nio.file.Files.readAllBytes( java.nio.file.Paths.get(targetURI) )); var text = new java.lang.String(java.nio.file.Files.readAllBytes(java.nio.file.Paths. get (targetURI)));
text = String(text); text = String(text);
eval(text); eval(text);
require.urisStack.pop(); require.urisStack.pop();
} }
} }