From 4ba3e101f631c19f082769f24386305a6f461cbf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 21 Jan 2015 17:38:26 -0800 Subject: [PATCH] Clean the init.coffee --- atom/browser/lib/init.coffee | 10 +++++----- atom/renderer/lib/init.coffee | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 3519a2cb0998..caf428fde079 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -24,7 +24,7 @@ globalPaths = module.globalPaths globalPaths.push path.join process.resourcesPath, 'atom', 'browser', 'api', 'lib' # Import common settings. -require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js') +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') if process.platform is 'win32' # Redirect node's console to use our own implementations, since node can not @@ -52,7 +52,8 @@ process.on 'uncaughtException', (error) -> require('dialog').showErrorBox 'A JavaScript error occured in the browser process', message # Emit 'exit' event on quit. -require('app').on 'quit', -> +app = require 'app' +app.on 'quit', -> process.emit 'exit' # Load the RPC server. @@ -77,7 +78,6 @@ for packagePath in searchPaths throw new Error("Unable to find a valid app") unless packageJson? # Set application's version. -app = require 'app' app.setVersion packageJson.version if packageJson.version? # Set application's name. @@ -90,14 +90,14 @@ else if packageJson.name? if packageJson.desktopName? app.setDesktopName packageJson.desktopName else - app.setDesktopName '#{app.getName()}.desktop' + app.setDesktopName "#{app.getName()}.desktop" # Set the user path according to application's name. app.setPath 'userData', path.join(app.getPath('appData'), app.getName()) app.setPath 'userCache', path.join(app.getPath('cache'), app.getName()) # Load the chrome extension support. -require './chrome-extension.js' +require './chrome-extension' # Finally load app's main.js and transfer control to C++. module._load path.join(packagePath, packageJson.main), module, true diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 11f933a0a838..eca509994ad0 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -19,7 +19,7 @@ globalPaths.push path.join(process.resourcesPath, 'atom', 'renderer', 'api', 'li globalPaths.push path.join(process.resourcesPath, 'app') # Import common settings. -require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init.js') +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') # Process command line arguments. nodeIntegration = 'false'