mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Shell commands installed on startup don't ask for admin privleges
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user