diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 77dacc934..339da0be6 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -47,3 +47,13 @@ module.exports = symlinkCommand(commandPath, destinationPath, installCallback) else installCallback(new Error("No destination directory exists to install")) + + installAtomCommand: (callback) -> + {resourcePath} = atom.getLoadSettings() + commandPath = path.join(resourcePath, 'atom.sh') + @install(commandPath, callback) + + installApmCommand: (callback) -> + {resourcePath} = atom.getLoadSettings() + commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm') + @install(commandPath, callback) diff --git a/src/window.coffee b/src/window.coffee index a6326087a..8c1f54327 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -20,8 +20,9 @@ window.setUpDefaultEvents = -> # This method is only called when opening a real application window window.startEditorWindow = -> if process.platform is 'darwin' - installAtomCommand() - installApmCommand() + CommandInstaller = require './command-installer' + CommandInstaller.installAtomCommand() + CommandInstaller.installApmCommand() windowEventHandler = new WindowEventHandler atom.restoreDimensions() @@ -56,16 +57,6 @@ window.unloadEditorWindow = -> atom.project.destroy() windowEventHandler?.unsubscribe() -installAtomCommand = (callback) -> - {resourcePath} = atom.getLoadSettings() - commandPath = path.join(resourcePath, 'atom.sh') - require('./command-installer').install(commandPath, callback) - -installApmCommand = (callback) -> - {resourcePath} = atom.getLoadSettings() - commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm') - require('./command-installer').install(commandPath, callback) - window.onerror = -> atom.openDevTools()