How can a node app find Atom's install directory?


#1

I’m writing a node app, not an Atom package, and I need to scan all core packages. How do I locate that packages directory? On my system it is C:\Chocolatey\lib\Atom.0.136.0\tools\Atom\resources\app\node_modules


#2

On a Unix-based system, I’d use which atom and resolve from there. On Windows, I’d either check to see if I could figure it out from the atom command line utility, check the Registry, or make a list of common install directories and ask the user if all else fails in all cases.


#3

Wow. Whatever happened to simple environment vars? This is a utility that very few people will run so I’ll just make them plug the path into the source code.

Thanks …


#4

Chocolatey does have env vars, I believe. And from there it will use some standard paths to each app. So if you’re assuming people follow the recommended install method, that’s your path.

However, for those who build on Windows from scratch or just use the downloaded zip folder, you won’t get around digging a bit deeper. If you’re lucky people added the executable to their path, so you could parse that variable (choco adds it to the path too, of course).
But if not? Like @leedohm says, asking the user, maybe via a Setting, would probably be a good last resort.

P.S. I took the liberty to go grammar-nazi on your post title. Hope you don’t mind.


#5

What did you change? How were you able to change it?


#6

See:


#7

Bump on the question of what you changed. Really curious since I’m a grammar nazi also with.


#8

The fact you didn’t notice any difference probably means I corrected it only to what you intended anyway. :wink:

If I remember correctly this is what it said before:
“How a node app find Atom install directory?”


#9

Whoa. I must have been drunk or something. :slight_smile:


#10

Sorry to clutter up the forum with non-technical stuff, but …

I posted the sentence ending in “since I’m a grammar nazi also with.” as a joke (lame). I just happened to find out that the rule to not end sentences with a preposition is a myth …

http://blog.oxforddictionaries.com/2011/11/grammar-myths-prepositions/

This is from the oxford dictionary.