1
0
Fork 0

follow up for issue #738

This commit is contained in:
Jan Steemann 2014-01-17 22:58:43 +01:00
parent f99f362f07
commit d10748155f
1 changed files with 3 additions and 1 deletions

View File

@ -740,7 +740,9 @@ function require (path) {
origin = description.path;
}
// strip protocol (e.g. file://)
origin = origin.replace(/^[a-z]+:\/\//, '');
if (typeof origin === 'string') {
origin = origin.replace(/^[a-z]+:\/\//, '');
}
sandbox.__filename = origin;
sandbox.__dirname = typeof origin === 'string' ? origin.split('/').slice(0, -1).join('/') : origin;