Re: NSOpenPanel & NSFileTypeForHFSTypeCode
Re: NSOpenPanel & NSFileTypeForHFSTypeCode
- Subject: Re: NSOpenPanel & NSFileTypeForHFSTypeCode
- From: John Stiles <email@hidden>
- Date: Wed, 10 Oct 2007 13:52:11 -0700
Corbin Dunn wrote:
On Oct 9, 2007, at 12:11 PM, Chris Heimark wrote:
I see in docs for NSOpenPanel and NSSavePanel that it is possible to
determine filetypes that will be shown/allowed in NSOpenPanel and
NSSavePanel via setFileTypes method.
And furthermore, one can use these two functions to take selectivity
down to the HFS+ OSType file level.
NSString *NSFileTypeForHFSTypeCode(OSType hfsTypeCode);
OSType NSHFSTypeCodeFromFileType(NSString *fileType);
My question is this: Where are the OSType's defined for files/
filesystems?
You probably don't want to go down this route.
And is it possible to use setFileTypes to only allow the selection
of a volume?
Yes. You will want to implement:
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
and return "NO" for non-volumes (you have to determine that by
whatever logic you want). This disables everything else.
You also probably want to preseed the directory to root with:
setDirectory:@"/Volumes", and/or call beginForDirectory:@"/Volumes"
-- unfortunately, /Volumes is slightly different than the 'computer'
node.
Will this technique show the boot volume (rooted at /)?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden