From 1f47e7ae6433cff7f497cdd7535910afb6e92780 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 13 Feb 2014 08:40:48 -0800 Subject: [PATCH] Remove check for /usr/local/bin --- src/command-installer.coffee | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/command-installer.coffee b/src/command-installer.coffee index a3b051e07..c0271975b 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -39,27 +39,23 @@ module.exports = commandName = path.basename(commandPath, path.extname(commandPath)) directory = @getInstallDirectory() - if fs.existsSync(directory) - destinationPath = path.join(directory, commandName) - unlinkCommand destinationPath, (error) => - # Retry with privilige escalation. - if error?.code is 'EACCES' and unlinkCommandWithPrivilegeSync(destinationPath) - error = null + destinationPath = path.join(directory, commandName) + unlinkCommand destinationPath, (error) => + # Retry with privilige escalation. + if error?.code is 'EACCES' and unlinkCommandWithPrivilegeSync(destinationPath) + error = null - if error? - error = new Error "Could not remove file at #{destinationPath}." + if error? + error = new Error "Could not remove file at #{destinationPath}." + callback?(error) + else + symlinkCommand commandPath, destinationPath, (error) => + # Retry with privilige escalation. + if error?.code is 'EACCES' and symlinkCommandWithPrivilegeSync(commandPath, destinationPath) + error = null + + error = new Error "Failed to symlink #{commandPath} to #{destinationPath}." if error? callback?(error) - else - symlinkCommand commandPath, destinationPath, (error) => - # Retry with privilige escalation. - if error?.code is 'EACCES' and symlinkCommandWithPrivilegeSync(commandPath, destinationPath) - error = null - - error = new Error "Failed to symlink #{commandPath} to #{destinationPath}." if error? - callback?(error) - else - error = new Error "Directory '#{directory} doesn't exist." - callback?(error) installAtomCommand: (resourcePath, callback) -> commandPath = path.join(resourcePath, 'atom.sh')