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.

I think just giving this UTType a file extension is better than that 
experience, but having NSSavePanel properly maintain the extension (or lack 
thereof) would be better still. Though I could easily imagine having multiple 
export types whose Mime type is public.folder.

-Tom

On Jan 17, 2013, at 3:22 PM, Quincey Morris 
<quinceymor...@rivergatesoftware.com> wrote:

> On Jan 17, 2013, at 14:12 , Thomas Bunch <t...@omnigroup.com> wrote:
> 
>> Launch, take your "document" (very much a stub), File -> Export…, "My Flat 
>> Format". Now File -> Export… again but this time pick "My HTML Folder 
>> Export". If you have your file extensions visible you'll see at this point 
>> that the extension is ".mff". Even so, the typical user will blow away their 
>> document at this point without a second thought.
> 
> Can't you detect this situation in the save code itself? If you're actually 
> replacing a file with a folder, at least if file extensions were hidden when 
> the save panel closed, you might want to abort the save. If you're replacing 
> a folder with a folder … well, you'd have to decide if it's important that 
> the existing folder has an extension, or doesn't appear to be the kind of 
> folder contents you're replacing it with.
> 
> Or, just look at the UTI for what you're replacing. If it's something your 
> app recognizes, you might want to avoid replacing it with a generic folder.
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to