From 3ba7d68d4a9eefc243cef84aea63f079cd10fedc Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 14 Jun 2013 09:56:01 -0700 Subject: [PATCH] Add global.homeDir Ick, this should be handled by an npm or hopefully a patch to Node. --- src/atom-application.coffee | 2 +- src/main.coffee | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/atom-application.coffee b/src/atom-application.coffee index 5551e92c0..b4fdfef81 100644 --- a/src/atom-application.coffee +++ b/src/atom-application.coffee @@ -261,7 +261,7 @@ class AtomApplication runSpecs: (exitWhenDone) -> specWindow = new AtomWindow bootstrapScript: 'spec-bootstrap' - resourcePath: path.join(@getHomeDir(), 'github', 'atom') + resourcePath: path.join(global.homeDir, 'github', 'atom') exitWhenDone: exitWhenDone isSpec: true diff --git a/src/main.coffee b/src/main.coffee index 1221e62d6..f834dde42 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -9,6 +9,8 @@ optimist = require 'optimist' nslog = require 'nslog' _ = require 'underscore' +global.homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] + console.log = (args...) -> nslog(args.map((arg) -> JSON.stringify(arg)).join(" ")) @@ -35,9 +37,6 @@ delegate.browserMainParts.preMainMessageLoopRun = -> AtomApplication.open(args) -getHomeDir = -> - process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] - setupCrashReporter = -> crashReporter.setCompanyName 'GitHub' crashReporter.setSubmissionUrl 'https://speakeasy.githubapp.com/submit_crash_log' @@ -85,7 +84,7 @@ parseCommandLine = -> dev = true resourcePath = args['resource-path'] else if dev - resourcePath = path.join(getHomeDir(), 'github', 'atom') + resourcePath = path.join(global.homeDir, 'github', 'atom') try fs.statSync resourcePath