Why don't file type filters work properly with nsIFilePicker on Mac OSX?
- by Eric Strom
I am running a chrome app in firefox (started with -app) with the following code to open a filepicker:
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
fp.init(window, "Select Files", nsIFilePicker.modeOpenMultiple);
fp.appendFilter("video", "*.mov; *.mpg; *.mpeg; *.avi; *.flv; *.m4v; *.mp4");
fp.appendFilter("all", "*.*");
var res = fp.show();
if (res == nsIFilePicker.returnCancel) return;
var files = fp.files;
var paths = [];
while (files.hasMoreElements()) {
var arg = files.getNext().QueryInterface(
Components.interfaces.nsILocalFile ).path;
paths.push(arg);
}
Everything seems to work fine on Windows, and the file picker itself works on OSX, but the dropdown menu to select between file types only displays in Windows. The first filter (video in this case) is in effect, but the dropdown to select the other type never shows. Is there something extra that is needed to get this working on OSX?
I have tried the latest firefox (3.6) and an older one (3.0.13) and both don't show the file type dropdown on OSX.