PDA

View Full Version : How to select hidden files in file open dialog


HoSpiTaL gHoSt
03-24-2009, 09:40 AM
Hello,

I've developed a Firefox Extension where you should be able to select hidden files from a file open dialog.
I've noticed that on Mac the hidden files weren't visible in Finder, so I looked up how to make them visible and it worked. But this solution doesn't seem to show the hidden files and folders in a file open dialog.
Please don't tell me the only solution is to install some sort of other filebrowser where it is possible to select hidden files, cause that is not what we want, we can't expect our customers to start modifying their Mac too much in order to make our component work.

They should also be able to select files from a file open dialog that are packaged into a .app-file, I hope this is also possible in some other way then by using terminal...

Thanks in advance to anyone who's trying to help!

dandj
03-27-2009, 02:58 AM
If you have a hidden folder open in the Finder, you can drag it's icon (next to the title) on to an Open/Save dialog box and it will become selected.

If there were hidden files visible in the folder they will also become usable in the Open/Save dialog box.

benwiggy
03-27-2009, 04:53 AM
I'm not sure why your customers should need to open hidden files in Firefox.

If you want them to have access to a range of files within an .app package, then you could perhaps create a menu list whose items point to the files.
Presumably, they will not be modifying nor adding to the files inside the package?

Could you provide more details about what you are trying to achieve?

HoSpiTaL gHoSt
03-27-2009, 05:20 AM
Thanks dandj, I'll try if that works, it's not the best solution, but at least it's A solution.

benwiggy, I've developed a Firefox Extension that will communicate with PKCS11 tokens. In order to read certificates from such a token, the user has to choose libraries that give access to those certificates. One of the libraries the user should be able to select, is the one installed by the eID software, and after installing it's located in the /usr folder, so it's hidden.

Another important library that will need to be loaded, is located in /Applications/Firefox.app/... The user should only select these libraries for reading, so the libraries will never be modified.

I just need a way so that the user can browse to these libraries, and select them to be used.

hayne
03-27-2009, 08:32 AM
1) Since you are writing a Firefox Extension (i.e. programming), I think this thread belongs in the Developers section. I'll move it there.

2) I assume you are using Carbon. If so, it seems (I have no experience with Carbon) that you can request that your open-file dialog show "invisible" files by setting the appropriate flag in the 'optionFlags' of the NavDialogCreationOptions struct that you pass to NavCreateGetFileDialog
(http://developer.apple.com/documentation/Carbon/Reference/Navigation_Services_Ref/Reference/reference.html#//apple_ref/doc/c_ref/NavCreateGetFileDialog)

HoSpiTaL gHoSt
03-27-2009, 08:49 AM
I'm very new to the Mac platform, so I've never even heard of Carbon. I developed my extension for Windows, Linux and Mac. The open file dialog I use is nsIFilepicker, an XPCOM-object from Mozilla, so it has nothing to do with Mac, but it is able to show an open file dialog from Javascript on any platform.

biovizier
03-27-2009, 09:29 AM
One of the libraries the user should be able to select, is the one installed by the eID software, and after installing it's located in the /usr folder, so it's hidden.

Another important library that will need to be loaded, is located in /Applications/Firefox.app.

I just need a way so that the user can browse to these libraries, and select them to be used.From your description, it sounds like the files are actually visible, but they are just in an invisible location.

If this is the case, then it should be possible to instruct users to use the standard "Go to Folder" function of OS X "open" and "save" dialogues. I.e. with the dialogue open, use the key combination Cmd-Shift-G and enter a path. And if the directories are visible but not normally accessible (eg. inside packages and bundles), then the "Go to Folder" dialogue will even accept dragged items (at least in 10.5 - this may not have been true in earlier versions).

However, since this just switches the directory whose contents are shown in the dialogue, this won't work if the files themselves are invisible...

HoSpiTaL gHoSt
03-27-2009, 10:05 AM
Thanks dandj and biovizier, both of your solutions worked, and I'm very happy that there's a solution, but none of them are very user friendly.

Biovizier, isn't there some kind of button in the file open dialog that does the same as pressing cmd + shift + g? I was actually looking for a location bar where you could enter a path manually, which is exactly what the "Go to folder" option does, but it's not obvious for a regular user to find this option!

Of course we can give our customers detailed instructions about how to select these hidden files, by opening them in Finder and then dragging the folder icon to the file open dialog or by using the "Go to folder" option.

hayne
03-27-2009, 11:41 AM
The open file dialog I use is nsIFilepicker, an XPCOM-object from Mozilla

You should file a bug (or enhancement request) against nsIFilepicker, asking that it provide some way to show hidden files.