[Project_owners] How to set the displayDirectory in a nsIFilePicker

Didier Ernotte didier at ernotte.com
Wed Dec 21 09:08:23 EST 2005


Ok, I've found it. It seems to be a bug in FF and not fixed yet

https://bugzilla.mozilla.org/show_bug.cgi?id=301298

Didier


--- Didier Ernotte <didier at ernotte.com> wrote:

> Hi,
> 
> I want to open a nsIFilePicker in the FF profile directory. I have
> read
> that the displayDirectory attribute should do this, but I can't make
> it
> work. The FilePicker opens, but in a totally different directory.
> 
> Here is my code
> 
>     var dir =
>
Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD",
> Components.interfaces.nsILocalFile);
>     var filePicker =
>
Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
>     filePicker.displayDirectory = dir;
>     filePicker.init(window, "Hello",
> Components.interfaces.nsIFilePicker.modeOpen);
>     filePicker.defaultString = null;
>     filePicker.appendFilters(filePicker.filterAll);
> 
>     filePicker.show();
> 
> 
> Thanks
> 
> Didier
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



More information about the Project_owners mailing list