Extension Hiding in NSSavePanel : Not Toggling properly?
Extension Hiding in NSSavePanel : Not Toggling properly?
- Subject: Extension Hiding in NSSavePanel : Not Toggling properly?
- From: Dan Wood <email@hidden>
- Date: Tue, 25 Sep 2001 13:20:30 -0700
(I'm assuming that now that 10.1 is out, we can talk about this
kind of stuff...)
I'm trying to do an NSSavePanel and handle the hidden extension
properly. It's not quite working right. In other
hidden-extension-savvy applications, the extension disappears and
reappears when I toggle the checkbox in the Save Panel. Is this
something I have to do manually through some hackery?
here's the salient code:
if ([savePanel
respondsToSelector:@selector(setCanSelectHiddenExtension:)])
{
[savePanel setCanSelectHiddenExtension:YES];
}
... then my saving code looks at the value of [sheet
isExtensionHidden]. If hidden, we append the extension ourselves
because it wasn't entered in the dialog. If not hidden, that means
that the extension should already be there. (BUT WHERE DOES THE
'DEFAULT' extension come from?) Then create and save the file with
the NSFileExtensionHidden attribute...
result = [[NSFileManager defaultManager]
createFileAtPath:path contents:data attributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:inHideExtension], NSFileExtensionHidden,
nil]];
Any suggestions for how to make my Save Panel work like I would
expect it to? Am I missing a method? The documentation is
incomplete, if so.... :-)
--
Dan Wood
email@hidden
http://www.karelia.com/
http://www.bikealameda.org/
Mac OS X Developer: Online Resume:
http://www.karelia.com/resume.html
"We have met the enemy and he is us" -- Walter Kelly (Pogo),
perhaps predicting the World Trade Center tragedy and America's
foreign policies and our sorry excuse for airline security...