Re: NSOpenPanel setDirectory to a package
Re: NSOpenPanel setDirectory to a package
- Subject: Re: NSOpenPanel setDirectory to a package
- From: Ken Thomases <email@hidden>
- Date: Wed, 18 Jun 2008 17:44:45 -0500
On Jun 18, 2008, at 5:18 PM, Dale Jensen wrote:
I have an "application picker" bit in my preferences, which allows
the user to select an app to do something. 90% of the time, I
presume, this will be a package, not a single file. My code is thus:
[oPanel setTreatsFilePackagesAsDirectories: NO];
NSString *filePath = @"/Applications/Preview.app"; // just for
example, it doesn't really default this way
[oPanel setDirectory:filePath];
I think those are the only relevant bits. When then open panel
comes up, the application is selected, and you're looking at the
root level of the package (ie: "Contents"). That's not what I
want, and not what I think the above code should result in. I
think that it should show the applications folder, with Preview
selected (but not "open" to the Contents folder.)
I disagree. There's a difference between restricting what the user
can do and a program restricting what it can do to itself.
setTreatsFilePackagesAsDirectories:NO is about the program
restricting the user, not itself. If the program then proceeds to
tell the NSOpenPanel to start in a particular directory, it should do
so, even if that would not be something the user would be allowed to do.
To accomplish what you want, you should specify the filename to the
begin... or runModal... method that you invoke.
Cheers,
Ken
_______________________________________________
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