Benjamin Smedberg <[EMAIL PROTECTED]> schrieb:

>Tobias Klein wrote:
> > So the first step for me is getting the actual Directory for my
> > program. I've used the following syntax so far:
>
>right
>
> > var dir_comp =
> > 
>Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIDirectoryServiceProvider);
>
>You're asking for the wrong interface; you want nsIProperties. 
>Unfortunately, this isn't very well documented. Also, this is a service, 
>so you need to "getService" instead of "createInstance". Try this:
>
>/* these are pretty standard declarations that make code
>    easier to read */
>const C = Components.classes;
>const I = Components.interfaces;
>
>dirService = 
>C["@mozilla.org/file/directory_service;1"].getService(I.nsIProperties);
>curProcDir = dirService.get("CurProcD", I.nsIFile);
>
>/* then you can clone the "curProcDir" and append your path */
>myRelPath = curProcDir.clone();
>myRelPath.append("myDirName");
>myRelPath.append("FileName.ext");
>
>--BDS

Thank you very much indeed! It works :D

Tobias Klein

Reply via email to