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: Thomas Bunch <email@hidden>
- Date: Thu, 17 Jan 2013 17:17:11 -0800
All good thoughts, but hold the phone.
I think I have a mishmash a lot of old deprecated info plist keys and outright misapprehensions in my Info.plist, especially under CFBundleDocumentTypes and UTExportedTypeDeclarations. I think the file extension swapping will behave correctly once I've gotten it fixed. I will post an update tomorrow.
I don't think your number 2 will be workable, since we're sandboxed/PowerBoxed here. If the NSSavePanel gives me a security scoped URL to a give file system path, I may not be able to write to a variant of that path.
-Tom
On Jan 17, 2013, at 4:57 PM, Quincey Morris <email@hidden> wrote:
> 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