From d99c9edc437a427c8beeeae6abec2d21021ae427 Mon Sep 17 00:00:00 2001 From: Brad Gearon Date: Wed, 7 May 2014 18:35:05 -0500 Subject: [PATCH 1/2] append .cmd to apm in package-manager.coffee if platform is win32 avoids NOENT error when searching for packages --- src/package-manager.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 89ab63ff7..e75c37d0b 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -4,6 +4,7 @@ _ = require 'underscore-plus' {Emitter} = require 'emissary' fs = require 'fs-plus' Q = require 'q' +os = require 'os' Package = require './package' ThemePackage = require './theme-package' @@ -43,7 +44,10 @@ class PackageManager # Public: Get the path to the apm command getApmPath: -> - @apmPath ?= path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm') + @commandName = 'apm' + if os.platform() == 'win32' + @commandName += '.cmd' + @apmPath ?= path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', @commandName) # Public: Get the paths being used to look for packages. # From e945b833184d7ef3ec6367a73e38e676897c94f9 Mon Sep 17 00:00:00 2001 From: Brad Gearon Date: Thu, 8 May 2014 12:38:17 -0500 Subject: [PATCH 2/2] remove os require use process.platform instead --- src/package-manager.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index e75c37d0b..201a32de2 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -4,7 +4,6 @@ _ = require 'underscore-plus' {Emitter} = require 'emissary' fs = require 'fs-plus' Q = require 'q' -os = require 'os' Package = require './package' ThemePackage = require './theme-package' @@ -44,10 +43,10 @@ class PackageManager # Public: Get the path to the apm command getApmPath: -> - @commandName = 'apm' - if os.platform() == 'win32' - @commandName += '.cmd' - @apmPath ?= path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', @commandName) + commandName = 'apm' + if process.platform == 'win32' + commandName += '.cmd' + @apmPath ?= path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', commandName) # Public: Get the paths being used to look for packages. #