[Project_owners] How to get the current directory

Nickolay Ponomarev asqueella at gmail.com
Tue Nov 7 16:43:36 PST 2006


On 11/8/06, Didier Ernotte <didier at ernotte.com> wrote:
> hi,
>
> I have a xul page (not an extension), and I need to read a file which is
> located in the same directory as the xul file. The problem I have is that
> the initWithPath on nsILocalFile needs an absolute path, and I don't want to
> hardcode the path in the xul file. How can I get the current directory
> (directory of the xul file) ? There is a lot of dir that I can access :
> Profile dir, home dir, mozilla dir, ... but nothing for the current dir.
> Thanks

You can get the current path from document.location, obviously.

Nickolay


More information about the Project_owners mailing list