From: Cheng Zhao Date: Sun, 22 Jun 2014 06:56:00 +0000 (+0800) Subject: Set process.mainModule to user's app. X-Git-Tag: v0.13.3~8^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=48224a6455c35f8f7cd2264abe4de510b29d5a1d;p=electron.git Set process.mainModule to user's app. --- diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 67ac2580..f5445a0c 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -1,6 +1,7 @@ -fs = require 'fs' -path = require 'path' -util = require 'util' +fs = require 'fs' +path = require 'path' +module = require 'module' +util = require 'util' # Expose information of current process. process.type = 'browser' @@ -17,7 +18,7 @@ process.execArgv = process.argv.splice startMark, endMark - startMark + 1 # Add browser/api/lib to require's search paths, # which contains javascript part of Atom's built-in libraries. -globalPaths = require('module').globalPaths +globalPaths = module.globalPaths globalPaths.push path.join process.resourcesPath, 'atom', 'browser', 'api', 'lib' # Do loading in next tick since we still need some initialize work before @@ -77,4 +78,4 @@ setImmediate -> app.setName packageJson.name # Finally load app's main.js and transfer control to C++. - require path.join(packagePath, packageJson.main) + module._load path.join(packagePath, packageJson.main), module, true