Alan,



I don’t know if that previews answer gave you what you were looking for but 
anyway just adding to it:




>From Azat Mardan:





4.7 __dirname vs. process.cwd




__dirname is an absolute path to the file in which this global variable was 
called, while process.cwd

is an absolute path to the process that runs this script. The latter might not 
be the same as the former

if we started the program from a different folder, e.g., $ node 
./code/program.js.




Sávio Lucena

On Wed, Sep 2, 2015 at 3:43 PM, Nathan Quinn <nathan.quinn...@gmail.com>
wrote:

> process.cwd();
> On Saturday, May 26, 2012 at 9:13:10 PM UTC-4, Alan Hoffmeister wrote:
>>
>> Hello there!
>>
>> How can I get the main path of the app?
>> Take a look at this example:
>>
>> 1) I have a module that return the app path, and I install it globally
>>     npm install -g mymodule
>>
>> 2) Than I have my app.js installed on /home/myuser/app.js
>>
>>    mymodule = require('mymodule');
>>    console.log(mymodule.path());
>>
>> 3) mymodule.path() needs to return the app path: /home/myuser
>>
>> How can I do this?
>>
>> --
>> Att,
>> Alan Hoffmeister
>>
> -- 
> Job board: http://jobs.nodejs.org/
> New group rules: 
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> --- 
> You received this message because you are subscribed to the Google Groups 
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/nodejs/d7a3b9d1-251b-490c-a487-88e7f1c2ae57%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/1441299472937.f8c8766%40Nodemailer.
For more options, visit https://groups.google.com/d/optout.

Reply via email to