PDA

View Full Version : Exposing . directories in the Finder window




forrie
Sep 5, 2010, 11:47 AM
A friend is writing a program that opens a Finder window to facilitate the selection of a configuration file. In this case, one potential location of a file resides in a prefixed "." directory (ie: /Users/rob/.name) which is not exposed in the Finder window -- and there doesn't appear to be a way to force that through the API.

It seems like a simple enough problem to solve; however, I wonder if someone here might have run into this before and have a solution.


Thanks...



Sydde
Sep 5, 2010, 01:47 PM
Try using NSWorkspace to tell Finder to open the folder. If the user has access to the folder (read/enter privilege), Finder will display the folder's content in a window even if the folder is hidden.

chown33
Sep 5, 2010, 02:04 PM
Why open a Finder window just to select a file?

That's what an NSOpenPanel is for.
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/AppFileMgmt/Tasks/UsingAnOpenPanel.html

It inherits setShowsHiddenFiles: from its superclass.


There's also this trick in any open/save panel:
http://macs.about.com/od/usingyourmac/qt/opensavehide.htm