Re: Using NSSavePanel to export to UTTypeFolder without a file extension.
Re: Using NSSavePanel to export to UTTypeFolder without a file extension.
- Subject: Re: Using NSSavePanel to export to UTTypeFolder without a file extension.
- From: Quincey Morris <email@hidden>
- Date: Thu, 17 Jan 2013 16:57:34 -0800
On Jan 17, 2013, at 16:20 , Thomas Bunch <email@hidden> wrote:
> Yes, in fact, I do exactly this. It's kind of suboptimal, in that NSSavePanel will first give you a warning:
>
>
> “Foo.oplx” already exists. Do you want to replace it?” and so on… the user will probably reflexively accept that one.
>
> Then we check and see that you're asking to dump a folder of web stuff, that the folder exists, that its contents don't look like a bucket of HTML and we pop up a second “That seems like a really bad idea, really really blow that away?” sheet.
Working backwards, it seems to me you really, really want to retain this last behavior in any situation where you're writing a folder to replace a folder. Even if the extensions behaved the way they should, you could easily get a situation where the user selected an entirely unrelated folder, and "reflexively" accepted the warning about that replacement.
If that's so, the extension behavior is somewhat a red herring. When you're exporting multiple types via a single dialog, writing one of the types on top of one of the other types is probably something you should always check for.
A couple of other thoughts:
1. Is there any value in configuring your save panel to hide the "show/hide extension" checkbox, and to always display extensions. That will, incidentally, ensure that the saved item will show its extension in the Finder, regardless of what the user normally does. You could then go ahead and use '.htmld' without ever misleading the user that it wasn't there.
2. You could probably arrange to keep the "htmld" behavior in the dialog, and rename the folder to remove the "htmld" at the end of the save. (You'd have to use a NSDocument "perform…" method to ensure you re-set the document's fileURL at the right time afterwards.) The drawback, of course, is that the un-extensioned folder may already exist, and you don't know what the user wants you to do about that. You *might* be able to mitigate that problem via the save panel delegate's validate method.
3. Is there any value in the idea of exporting folders of stuff (that is, exporting things that don't have a unique UTI) via a separate menu item that doesn't involve choosing a type in its save panel?
_______________________________________________
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