From 763c5053ade6759ee43969fb8ee6a4553271ad67 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 13 Feb 2014 10:00:18 -0800 Subject: [PATCH] Shell commands installed on startup don't ask for admin privleges --- src/atom.coffee | 4 ++-- src/command-installer.coffee | 12 ++++++------ src/workspace-view.coffee | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 9cfffb74a..0f951aebc 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -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() diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 241195d86..5308e5a8e 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -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 diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index bbe24d779..a83253a89 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -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