Currently, both read() and load() in d8 refer to $PWD. While I see the
problem you are having, I currently don't see an adequate solution
because d8 may take several input files, each residing inside a
different directory. It's not obvious which the path relative to the
cli script would be. Any suggestions?

-- Yang

On Nov 11, 8:41 pm, Buck Golemon <[email protected]> wrote:
> I miss-spoke. smjs does read() relative to the script's directory, and
> load() relative to the user's directory. That's exactly backwards from
> what I need. Hah!
>
> On Nov 11, 9:34 am, Buck Golemon <[email protected]> wrote:
>
>
>
>
>
>
>
> > I'm trying to get jshint (http://www.jshint.com/) running at the
> > commandline under d8. To do this, I need to do two things.
>
> > 1) Load the jshint library, which is a path relative to the cli
> > script, like "../jshint.js".
>
> > 2) Read an input file, which (may be) a path relative to the users'
> > $PWD, like "./myproj/lib/neat_thing.js"
>
> > For #2, I can use `os.system("readlink", ["-f", input_file])` to get
> > an absolute path to pass to read().
>
> > For #1, I'm completely stymied. Is there any way to do this?
>
> > For the record, this is much easier under the spidermonkey console
> > (smjs). The load() function interprets paths as relative to the script
> > under execution, and I can get the users' $PWD with just
> > "environment.PWD".

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to