Re: NSOpenPanel & NSFileTypeForHFSTypeCode
Re: NSOpenPanel & NSFileTypeForHFSTypeCode
- Subject: Re: NSOpenPanel & NSFileTypeForHFSTypeCode
- From: Chris Heimark <email@hidden>
- Date: Wed, 10 Oct 2007 17:18:15 -0400
On Oct 10, 2007, at 4:52 PM, John Stiles wrote:
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?
Is the implication of this statement that there are NO fileType
symbols that would narrow the scope of the selectable files? I
presume answer is YES.
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 /)?
I am going to qualify the list of usable volumes for my application
using NSTask running diskutil and filtering ONLY for the volumes I
want - which in my case are USB mounted flash drives. So I may just
end up with a NSPopupButton selector filled with only qualified
volumes. So '/' will not be one of them...
This appears to be my only alternative ... unless a future OS brings
a solution ... which I'll know about soon enough ;-)
_______________________________________________
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