I finally figured this out.  If I use a node script, "#!/usr/bin/env node",
instead of a bash script, "#!/bin/bash",  then the node script can simply
reference __dirname. It was really hard and messy using bash.  I guess this
is what several of you were trying to tell me.

On Mon, Aug 5, 2013 at 1:40 AM, Floby <florent.j...@gmail.com> wrote:

> I assume your module structure looks like this
>
> /bin/myBin.js
> /lib/myUtil.js
> index.js
> package.json
>
>
> /// index.js
> exports.util = require('./lib/myUtil')
> exports.projectDir = __dirname
>
>
> /// bin/myBin.js
> var dir = require('../').projectDir
>
>
> Does that do what you want?
>
> On Saturday, 3 August 2013 21:24:20 UTC+2, Mark Hahn wrote:
>>
>> I'm using an npm bin config to create a symlink to a script in my project
>> folder.  When that bin script runs, it has a working directory of the dir
>> the symlink is in, not the project folder.  How do I find the project
>> folder location inside that bin script?
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> 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 post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to