Re: NSFileWrapper
Re: NSFileWrapper
- Subject: Re: NSFileWrapper
- From: Charles Srstka <email@hidden>
- Date: Sun, 05 Jun 2016 01:52:07 -0500
> On Jun 5, 2016, at 1:27 AM, Graham Cox <email@hidden> wrote:
>
>
>> On 5 Jun 2016, at 8:02 AM, Daryle Walker <email@hidden> wrote:
>>
>> You have to come up with a new extension. For instance, if you’re already using “.xyz” for you single-file format, you could use “.xyz-pkg” for your package format.
>
>
> You can use the same extension and leave it to your app to figure out which it’s actually dealing with - the extension is only used to map the file to an app that can open it - after that the file will be passed to NSDocument as a NSFileWrapper whatever its contents - packagae or flat file. Your app can then determine which it is based on some private knowledge about its structure.
>
> Alternatively, make up a new extension - the amount of work for your app is about the same, so the question is whether you want to disguise the change for end users.
>
> —Graham
My favorite way to deal with bundle documents is to just override readFromURL:ofType:error:, make an NSBundle from that, and load things lazily as needed.
Every time I’ve ever tried to use NSFileWrapper, I’ve always ended up having to switch to something else because of the memory issue that Jens mentions. Never really understood the point of that class.
Charles
_______________________________________________
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