Add a setting for specifying path to node on OSX
In my local version of the plugin I added an osx_node_path entry to .sublime-settings (I'm an OSX user that installs node via NVM).
Adding some official support for that would be nice. I'm happy to submit a patch, but I'm not familiar with Sublime's internals enough to know how to use that same setting in the build system -- which would important.
Here's a patch showing what I'm currently doing:
From 3d11fedf2ac76aa6a319486e43029ffd144bd5ba Mon Sep 17 00:00:00 2001
From: Matt McCray <[email protected]>
Date: Mon, 7 Oct 2013 17:07:37 -0500
Subject: [PATCH] Added support for custom osx_node_path
---
Typescript.py | 10 ++++++----
Typescript.sublime-settings | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Typescript.py b/Typescript.py
index f7caf9f..bedd6bb 100644
--- a/Typescript.py
+++ b/Typescript.py
@@ -415,15 +415,17 @@ class TssInit(Thread):
if self.settings.get('local_tss'):
if sys.platform == "darwin":
- self.result = Popen(['/usr/local/bin/node', TSS_PATH ,self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
- p = Popen(['/usr/local/bin/node', TSS_PATH, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
+ node_path = self.settings.get('osx_node_path')
+ self.result = Popen([node_path + '/bin/node', TSS_PATH ,self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
+ p = Popen([node_path + '/bin/node', TSS_PATH, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
else:
self.result = Popen(['node', TSS_PATH, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
p = Popen(['node', TSS_PATH, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
else:
if sys.platform == "darwin":
- self.result = Popen(['/usr/local/bin/node', '/usr/local/lib/node_modules/tss/bin/tss.js' ,self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
- p = Popen(['/usr/local/bin/node', '/usr/local/lib/node_modules/tss/bin/tss.js', self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
+ node_path = self.settings.get('osx_node_path')
+ self.result = Popen([node_path + '/bin/node', node_path + '/lib/node_modules/tss/bin/tss.js' ,self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
+ p = Popen([node_path + '/bin/node', node_path + '/lib/node_modules/tss/bin/tss.js', self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
else:
self.result = Popen([cmd, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
p = Popen([cmd, self.filename], stdin=PIPE, stdout=PIPE, **kwargs)
diff --git a/Typescript.sublime-settings b/Typescript.sublime-settings
index 24aca0c..b09f522 100644
--- a/Typescript.sublime-settings
+++ b/Typescript.sublime-settings
@@ -1,6 +1,7 @@
{
"local_tss":true,
"error_on_save_only":false,
+ "osx_node_path": "/usr/local",
"build_parameters":{
"pre_processing_commands":[],
--
1.7.12
Hi @darthapo
I'm currently working on the new version of the plugin, and the build system will be integrated inside the plugin, i also added the node path option, so next version build, error, completions etc... can have the node path settings.
For the build system in the current state plugin you can edit the .sublime-build file and add your path to the osx path entry.
@Railk Thanks!
In dev branch