1
0
Fork 0

Added __dirname, __filename pseudo-globals. Fixes #733.

This commit is contained in:
Alan Plum 2014-01-17 21:31:16 +01:00 committed by Jan Steemann
parent 0c039e0264
commit 3e653e303d
1 changed files with 4 additions and 0 deletions

View File

@ -735,6 +735,8 @@ function require (path) {
}
}
sandbox.__filename = origin;
sandbox.__dirname = typeof origin === 'string' ? origin.split('/').slice(0, -1).join('/') : origin;
sandbox.module = module;
sandbox.exports = module.exports;
sandbox.require = function(path) { return module.require(path); };
@ -1326,6 +1328,8 @@ function require (path) {
}
}
sandbox.__filename = full;
sandbox.__dirname = full.split('/').slice(0, -1).join('/');
sandbox.module = appModule;
sandbox.applicationContext = appContext;