Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer using my PATH #93

Open
hansrodtang opened this issue Apr 8, 2014 · 9 comments
Open

No longer using my PATH #93

hansrodtang opened this issue Apr 8, 2014 · 9 comments

Comments

@hansrodtang
Copy link
Contributor

Since the latest update (Might be Atom update or atom-script, I updated both at the same time), atom-script no longer detects my PATH even though a Terminal plugin with "env" detects it just fine.

It still works through terminal, but the PATH through the Atom Terminal is the same as it was before, even without the terminal.

screenshot 2014-04-08 02 15 29

@erran
Copy link
Collaborator

erran commented Apr 13, 2014

@hansrodtang What do you think about my patch related to this on #98?

@rgbkrk
Copy link
Member

rgbkrk commented Apr 16, 2014

How are you launching?

@erran
Copy link
Collaborator

erran commented Apr 19, 2014

@hansrodtang From a comment on #98:

This definitely is something that doesn't belong in atom-script. Regardless, below are a few immediate findings.

Turns out if you add a key under editor/core the main settings page will register that on window reload (or closing and restarting atom):

# ~/.atom/config.cson
'core':
  'PATH': '/Users/ecarey/.rbenv/shims:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin'
  ...
  'projectHome': '/Users/ecarey/repositories'

screen shot 2014-04-17 at 09 12 57

# ~/.atom/init.coffee
path = atom.config.get('core.PATH')
if path
  process.env.PATH = path

A few possible difficulties with this method:

  • Reloading windows, how would that work?
  • How does this affect launching from the command line?
  • Should we use a PATH_PREFIX instead and prepend it on init?

@rgbkrk
Copy link
Member

rgbkrk commented Apr 22, 2014

@hansrodtang - Is this problem still coming up? Where are you launching from?

@hansrodtang
Copy link
Contributor Author

This is still a problem. I am launching it trough GUI, this worked before (after adding stuff to some .bashrc file). But now atom-script won't detect it even though plugins like atom-terminal (command env) detects them just fine.

@rockymadden
Copy link

Chiming in that I too experienced this issue (with Scala). The path referenced in the message is identical to @hansrodtang. I have Scala installed via homebrew and so a path with /usr/local/bin is required.

The solution @erran referenced did work however.

@jeffcjohnson
Copy link

In the hopes it may save people time finding a solution for this, I did what @hansrodtang did in a related issue to solve this on OS X.

I added the following to ~/.bash_profile:

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

@rgbkrk
Copy link
Member

rgbkrk commented Nov 7, 2014

@jeffcjohnson Interesting.

@dustinblackman
Copy link
Contributor

I'm not the best with Coffeescript, but this is something I threw in my init.coffee to read all my paths currently saved in my zsh config, and then set them in Atom. Worked like a charm. Current setup is for a Mac, should be the same for Linux, Windows however will probably need some tweaking. You can of course change the .zshrc file to anything else you need if required.

https://gist.github.com/dustinblackman/db56445e5d649ccbd2b2

fs = require('fs')

# Import ENV from zsh config.
fs.readFile process.env.HOME+"/.zshrc", "utf8", (err, zshFile) ->
  envPaths = []
  for l in zshFile.split('\n')
    if l.substring(0,11) is 'export PATH'
      e = l.split('=').splice(-1)[0]
      e = e.replace(':$PATH','').replace(/"/g,'')
      if ':' in e
        for x in e.split(':')
          envPaths.push(x)
      else
        envPaths.push(e)
  process.env.PATH = envPaths.join(':')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants