Re: NSSavePanel and allowing unknown extensions
Re: NSSavePanel and allowing unknown extensions
- Subject: Re: NSSavePanel and allowing unknown extensions
- From: Ken Baer <email@hidden>
- Date: Fri, 6 Jul 2007 09:40:41 -0700
OK, I understand now. When I typed a known extension it asked me
which extension to use, and when I typed in an unknown extension, it
appended the default extension. First it seemed to be working, and
then it seemed to append in another part of the code. I thought I
was going insane! :-) It makes more sense now.
Thanks!
On Jul 6, 2007, at 2:23 AM, Peter Duniho wrote:
From: Ken Baer <email@hidden>
I'm having a problem with getting a save dialog to not append the
extension on the end the filename when the user types in a different
extension. [...] Here is some sample code.
NSSavePanel* saveDialog = [NSSavePanel savePanel];
[saveDialog setAllowedFileTypes:[NSArray
arrayWithObject:@"mov"]];
[saveDialog setAllowsOtherFileTypes:YES];
if ([saveDialog runModal] != NSFileHandlingPanelOKButton)
return NO;
Am I missing something?
I have code that looks pretty much just like that, and it does what
I'd expect: if the user enters a filename with an extension other
than those allowed, a dialog pops up asking if the user really
wants to use the extension they entered.
Note that the dialog only appears if the alternative extension the
user enters is one that is recognized (by the OS, I think, but I
suppose it could be something specific in Cocoa). If it's not a
recognized extension, then the filename is treated as though it has
no extension, and your provided extension is appended.
I presume that this behavior is to deal with the common case of
files that have periods in their names, but which don't really have
an extension per se. Much more common in the *nix world than for
traditional PCs (Mac and Windows).
Does that help?
Pete
_______________________________________________
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:
40comcast.net
This email sent to email@hidden
-Ken Baer.
BaerCode
_______________________________________________
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