node-webkit has no current directory?

11 views
Skip to first unread message

bos...@gmail.com

unread,
Dec 17, 2012, 12:11:55 AM12/17/12
to node-...@googlegroups.com
Hi,
I cannot find the current directry whose an app executed with *.nw.
the global.__dirname is undefined in node-webkit, 
but system current directory exists whose an app exected with nw-dir
(e.g. $ nw .)

How I access the infomation for the current directory with Javascript?

regards,
Kanryu

Roger

unread,
Dec 17, 2012, 12:20:31 AM12/17/12
to node-...@googlegroups.com
On Mon, Dec 17, 2012 at 1:11 PM, <bos...@gmail.com> wrote:
> Hi,
> I cannot find the current directry whose an app executed with *.nw.
> the global.__dirname is undefined in node-webkit,

This should be a bug. We'll fix it.

> but system current directory exists whose an app exected with nw-dir
> (e.g. $ nw .)
>
> How I access the infomation for the current directory with Javascript?

There were some discussion here in the mailing list, which could be helpful:

https://groups.google.com/d/topic/node-webkit/IwGzluFC9iU/discussion
https://groups.google.com/d/topic/node-webkit/cMjpP4ptrWg/discussion

Roger

Roger

unread,
Dec 17, 2012, 12:23:16 AM12/17/12
to node-...@googlegroups.com
On Mon, Dec 17, 2012 at 1:20 PM, Roger <wen...@gmail.com> wrote:
>> I cannot find the current directry whose an app executed with *.nw.
>> the global.__dirname is undefined in node-webkit,
>
> This should be a bug. We'll fix it.

Filed as: https://github.com/rogerwang/node-webkit/issues/264

You could track it there.

Roger

bos...@gmail.com

unread,
Dec 17, 2012, 5:19:38 AM12/17/12
to node-...@googlegroups.com


Filed as: https://github.com/rogerwang/node-webkit/issues/264

You could track it there.

Thanks.
I found process.cwd() as system current dir.(sometimes temporary directory) 

and I want the path which nw.exe is running.
Because of loading/saving application's config files.

Regards,
Kanryu

Roger WANG

unread,
Dec 17, 2012, 7:35:06 AM12/17/12
to bos...@gmail.com, node-...@googlegroups.com
You can check with path.dirname(process.execPath)

I'll add these information to wiki since they are FAQs.
--
Roger WANG Intel Open Source Technology Center

Reply all
Reply to author
Forward
0 new messages