From 1bd4d518797cfd33db47eb191f445fda97006be9 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 21 Jan 2014 18:00:59 -0800 Subject: [PATCH] Install atom and apm cli commands to /usr/local/bin --- src/command-installer.coffee | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/command-installer.coffee b/src/command-installer.coffee index aa6a9e803..622e3a249 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -23,10 +23,6 @@ unlinkCommand = (destinationPath, callback) -> callback() module.exports = - findInstallDirectory: (callback) -> - directories = ['/opt/boxen', '/opt/github', '/usr/local'] - async.detect(directories, fs.isDirectory, callback) - install: (commandPath, commandName, callback) -> if not commandName? or _.isFunction(commandName) callback = commandName @@ -37,17 +33,17 @@ module.exports = console.warn "Failed to install `#{commandName}` binary", error callback?(error, sourcePath, destinationPath) - @findInstallDirectory (directory) -> - if directory? - destinationPath = path.join(directory, 'bin', commandName) - unlinkCommand destinationPath, (error) -> - if error? - installCallback(error) - else - symlinkCommand commandPath, destinationPath, (error) -> - installCallback(error, commandPath, destinationPath) - else - installCallback(new Error("No destination directory exists to install")) + directory = "/usr/local" + if fs.existsSync(directory) + destinationPath = path.join(directory, 'bin', commandName) + unlinkCommand destinationPath, (error) -> + if error? + installCallback(error) + else + symlinkCommand commandPath, destinationPath, (error) -> + installCallback(error, commandPath, destinationPath) + else + installCallback(new Error("No destination directory exists to install")) installAtomCommand: (resourcePath, callback) -> if _.isFunction(resourcePath)