electron/atom/common/api/lib/original-fs.coffee
Cheng Zhao 0933a7d1b2 Evaluate the "fs.js" in original-fs
Some high-level APIs in fs are using low-level APIs via "fs.xxx", which
will be overriden by our asar wrappers, so just shadow-copy those
methods is not enough.

By evaluating the whole "fs.js" we can make sure original-fs is not
polluted by the asar wrappers.

Fixes #782.
2015-01-19 14:22:32 -08:00

8 lines
288 B
CoffeeScript

vm = require 'vm'
# Execute the 'fs.js' and pass the 'exports' to it.
source = '(function (exports, require, module, __filename, __dirname) { ' +
process.binding('natives').fs +
'\n});'
fn = vm.runInThisContext source, { filename: 'fs.js' }
fn exports, require, module