Shell commands installed on startup don't ask for admin privleges

This commit is contained in:
probablycorey
2014-02-13 10:00:18 -08:00
parent 3053760880
commit 763c5053ad
3 changed files with 10 additions and 10 deletions

View File

@@ -250,9 +250,9 @@ class Atom extends Model
startEditorWindow: ->
CommandInstaller = require './command-installer'
resourcePath = atom.getLoadSettings().resourcePath
CommandInstaller.installAtomCommand resourcePath, (error) ->
CommandInstaller.installAtomCommand resourcePath, false, (error) ->
console.warn error.message if error?
CommandInstaller.installApmCommand resourcePath, (error) ->
CommandInstaller.installApmCommand resourcePath, false, (error) ->
console.warn error.message if error?
@restoreWindowDimensions()

View File

@@ -34,13 +34,13 @@ module.exports =
getInstallDirectory: ->
"/usr/local/bin"
install: (commandPath, callback) ->
install: (commandPath, askForPrivilege, callback) ->
return unless process.platform is 'darwin'
commandName = path.basename(commandPath, path.extname(commandPath))
destinationPath = path.join(@getInstallDirectory(), commandName)
symlinkCommand commandPath, destinationPath, (error) =>
if error?.code is 'EACCES'
if askForPrivilege and error?.code is 'EACCES'
try
error = null
symlinkCommandWithPrivilegeSync(commandPath, destinationPath)
@@ -48,10 +48,10 @@ module.exports =
callback?(error)
installAtomCommand: (resourcePath, callback) ->
installAtomCommand: (resourcePath, askForPrivilege, callback) ->
commandPath = path.join(resourcePath, 'atom.sh')
@install commandPath, callback
@install commandPath, askForPrivilege, callback
installApmCommand: (resourcePath, callback) ->
installApmCommand: (resourcePath, askForPrivilege, callback) ->
commandPath = path.join(resourcePath, 'apm', 'node_modules', '.bin', 'apm')
@install commandPath, callback
@install commandPath, askForPrivilege, callback

View File

@@ -146,11 +146,11 @@ class WorkspaceView extends View
detailedMessage: error.message
resourcePath = atom.getLoadSettings().resourcePath
CommandInstaller.installAtomCommand resourcePath, (error) =>
CommandInstaller.installAtomCommand resourcePath, true, (error) =>
if error?
showErrorDialog(error)
else
CommandInstaller.installApmCommand resourcePath, (error) =>
CommandInstaller.installApmCommand resourcePath, true, (error) =>
if error?
showErrorDialog(error)
else