Re: NSDocument and Large File Import?
Re: NSDocument and Large File Import?
- Subject: Re: NSDocument and Large File Import?
- From: Quincey Morris <email@hidden>
- Date: Thu, 20 Jun 2013 14:41:31 -0700
On Jun 20, 2013, at 14:22 , Karl Moskowski <email@hidden> wrote:
> So, when importing the asset upon new document creation, actually import it to a temp directory, then upon save of the document, hard-link to the temp asset (via NSFileManager methods)? How would you delete the original hard link from the temp directory? Just delete the temp directory itself non-recursively? (I couldn’t find any unlinking APIs.)
Even easier, you just delete the file. When you hard link, there's nothing at all unusual about the files (other than the fact they they are hard-linked to the same disk data). The data itself is, in effect, reference counted, so it won't disappear until the last file using it is deleted.
> In modern document-based apps, this would be via the “Duplicate” menu, right?
That's one scenario Another scenario is when a new document has been autosaved, which is typically to a local hard disk, and then the user chooses a different volume when prompted to save on closing the window.
I may have slightly overstated the case earlier. If your embedded asset file never changes after being created, they you likely won't have any code to clone it yourself, since the NSDocument default behavior does this for you. However, if you don't have an existing file wrapper to trigger this, as when the document is first created, you need to do the cloning yourself.
_______________________________________________
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