]> khamidou — GitHub mirrors - electron.git/commitdiff
Redirect process.binding('natives').fs to global fs object
authorCheng Zhao <zcbenz@gmail.com>
Sun, 1 Feb 2015 07:47:47 +0000 (23:47 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 2 Feb 2015 21:35:32 +0000 (13:35 -0800)
atom/common/api/lib/original-fs.coffee
atom/common/lib/init.coffee

index 3868168343fc22a1a5d92d4cd096b7e0267c1024..e4e47f33120bdc69ec9a9f2968dac8c45a0d9a7a 100644 (file)
@@ -2,7 +2,7 @@ vm = require 'vm'
 
 # Execute the 'fs.js' and pass the 'exports' to it.
 source = '(function (exports, require, module, __filename, __dirname) { ' +
-         process.binding('natives').fs +
+         process.binding('natives').originalFs +
          '\n});'
 fn = vm.runInThisContext source, { filename: 'fs.js' }
 fn exports, require, module
index 2d7fc73b994ec1b43f58078433e7df77640b879a..5594fd8dad5f670e6eaa2d48f14606466eb6934f 100644 (file)
@@ -39,3 +39,8 @@ if process.type is 'browser'
 # Add support for asar packages.
 asar = require './asar'
 asar.wrapFsWithAsar fs
+
+# Make graceful-fs work with asar.
+source = process.binding 'natives'
+source.originalFs = source.fs
+source.fs = "module.exports = require('fs');"