electron/lib/common/asar_init.js

21 lines
666 B
JavaScript
Raw Normal View History

(function () {
2016-01-19 18:25:03 +00:00
return function(process, require, asarSource) {
// Make asar.coffee accessible via "require".
process.binding('natives').ATOM_SHELL_ASAR = asarSource;
2016-01-12 02:40:23 +00:00
2016-01-19 18:25:03 +00:00
// Monkey-patch the fs module.
require('ATOM_SHELL_ASAR').wrapFsWithAsar(require('fs'));
2016-01-12 02:40:23 +00:00
2016-01-19 18:25:03 +00:00
// Make graceful-fs work with asar.
2016-01-19 22:49:40 +00:00
var source = process.binding('natives');
2016-01-19 18:25:03 +00:00
source['original-fs'] = source.fs;
2016-03-27 10:13:15 +00:00
return source['fs'] = `
var nativeModule = new process.NativeModule('original-fs');
nativeModule.cache();
nativeModule.compile();
var asar = require('ATOM_SHELL_ASAR');
asar.wrapFsWithAsar(nativeModule.exports);
module.exports = nativeModule.exports`;
2016-01-19 18:25:03 +00:00
};
2016-01-19 22:53:59 +00:00
})();