Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/config.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
path = require 'path'
fs = require 'fs'

module.exports =
getHomeDirectory: ->
Expand All @@ -24,3 +25,21 @@ module.exports =

isWin32: ->
!!process.platform.match(/^win/)

isWindows64Bit: ->
fs.existsSync "C:\\Windows\\SysWow64\\Notepad.exe"

x86ProgramFilesDirectory: ->
process.env["ProgramFiles(x86)"] || process.env["ProgramFiles"]

isVs2010Installed: ->
return false unless isWin32()

vsPath = path.join x86ProgramFilesDirectory(), "Microsoft Visual Studio 10.0", "Common7", "IDE", "devenv.exe"
fs.existsSync vsPath

isVs2012Installed: ->
return false unless isWin32()

vsPath = path.join x86ProgramFilesDirectory(), "Microsoft Visual Studio 11.0", "Common7", "IDE", "devenv.exe"
fs.existsSync vsPath
11 changes: 9 additions & 2 deletions src/installer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,23 @@ class Installer extends Command
else
process.stdout.write '\u2717\n'.red
callback(stdout.red + stderr.red)

installModule: (options, modulePath, callback) ->
process.stdout.write "Installing #{modulePath} to #{@atomPackagesDirectory} "

vsArgs = null
if config.isWin32()
vsArgs = "--msvs_version=2010" if config.isVs2010Installed()
vsArgs = "--msvs_version=2012" if config.isVs2012Installed()

throw new Error("You must have either VS2010 or VS2012 installed") unless vsArgs

installArgs = ['--userconfig', config.getUserConfigPath(), 'install']
installArgs.push(modulePath)
installArgs.push("--target=#{config.getNodeVersion()}")
installArgs.push('--arch=ia32')
installArgs.push('--silent') if options.argv.silent
installArgs.push('--msvs_version=2012') if config.isWin32()
installArgs.push(vsArgs) if vsArgs?

env = _.extend({}, process.env, HOME: @atomNodeDirectory)

installDirectory = temp.mkdirSync('apm-install-dir-')
Expand Down