From 8e616efa100b254e9c931b17249b5b377c0334df Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Tue, 5 Jan 2016 13:00:33 -0800 Subject: [PATCH] Add config for jupyter binary path --- lib/main.js | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/main.js b/lib/main.js index ba80e6a..6c5882d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -7,10 +7,19 @@ import {CompositeDisposable} from 'atom'; import {delimiter} from 'path'; import Dispatcher from './dispatcher'; import NotebookEditor from './notebook-editor'; -import NotebookEditorView from './notebook-editor-view';`` +import NotebookEditorView from './notebook-editor-view'; export default { + config: { + jupyterPath: { + title: 'Path to jupyter binary', + description: '', + type: 'string', + default: 'usr/local/bin' + } + }, + activate(state) { // console.log('Activated'); fixPath(); @@ -57,19 +66,22 @@ export default { }; function fixPath() { + let defaultPaths = [ + '/usr/local/bin', + '/usr/bin', + '/bin', + '/usr/local/sbin', + '/usr/sbin', + '/sbin', + './node_modules/.bin' + ]; + let jupyterPath = atom.config.get('jupyter-notebook.jupyterPath'); + if (defaultPaths.indexOf(jupyterPath) < 0) defaultPaths.unshift(jupyterPath); if (process.platform === 'darwin') { process.env.PATH = process.env.PATH.split(delimiter).reduce((result, path) => { if (!result.find(item => item === path)) result.push(path); return result; - }, [ - '/usr/local/bin', - '/usr/bin', - '/bin', - '/usr/local/sbin', - '/usr/sbin', - '/sbin', - './node_modules/.bin' - ]).join(delimiter); + }, defaultPaths).join(delimiter); } }