On Jun 20, 2013, at 5:41 PM, Quincey Morris <quinceymor...@rivergatesoftware.com> wrote:
> On Jun 20, 2013, at 14:22 , Karl Moskowski <kmoskow...@me.com> 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. Of course! Just delete one of the hard links. The other, and its referenced data, are still around. >> 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. It is possible that the embedded asset could change — the user could re-import another asset to take its place. —Karl.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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