Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 1958e79

Browse files
committed
remove the filename from the current module's path
1 parent 87b9a70 commit 1958e79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/org/mozilla/javascript/commonjs/module/Require.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private Scriptable executeModuleScript(Context cx, String id,
337337
// in our Rhino shim for Node.js' global "process.cwd()" method and its
338338
// global "__dirname" property.
339339
String oldUserDir = System.getProperty("user.dir");
340-
System.setProperty("user.dir", new File(uri).getPath());
340+
System.setProperty("user.dir", new File(uri).getParentFile().getPath());
341341

342342
final Scriptable executionScope = new ModuleScope(nativeScope, uri, base);
343343
// Set this so it can access the global JS environment objects.

0 commit comments

Comments
 (0)