Make "original-fs" available as built-in module

This commit is contained in:
Cheng Zhao 2015-05-20 13:29:05 +08:00
parent 4129d45d21
commit 0e7bc6b8ec

View file

@ -9,10 +9,10 @@ return (process, require, asarSource) ->
# Make graceful-fs work with asar. # Make graceful-fs work with asar.
source = process.binding 'natives' source = process.binding 'natives'
source.originalFs = source.fs source['original-fs'] = source.fs
source.fs = """ source['fs'] = """
var src = '(function (exports, require, module, __filename, __dirname) { ' + var src = '(function (exports, require, module, __filename, __dirname) { ' +
process.binding('natives').originalFs + process.binding('natives')['original-fs'] +
' });'; ' });';
var vm = require('vm'); var vm = require('vm');
var fn = vm.runInThisContext(src, { filename: 'fs.js' }); var fn = vm.runInThisContext(src, { filename: 'fs.js' });