Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing NSDocument's default saving behavior



I would like to customize the way my NSDocument subclass saves files.

As best I can tell, the default behavior of NSDocument is to first save the file to a temporary location (for me /private/tmp/XXX), then copy the temporary file over the original. I assume this is done for purposes of trying to keep operations atomic, or preventing data loss in case of a network error for NFS (or something more cosmic I didn't think of).

This behavior works well for small files, plists, or when the entire data of the file is used or manipulated by the application. However, I have written an editor for metadata in FLAC and Ogg Vorbis files. These files are large, generally several MB, but the metadata is typically only the first 8-10 KB. I would like to be able to do an "in-place" save, modifying the original file versus being forced to copy the original to the save destination, then modifying the copy, which is then subsequently renamed. The performance hit for saving an 18 MB FLAC file this way versus modifying the metadata in place is simply enormous!

Which methods would I need to override to achieve this? I have tried everything I can think of; I am able to modify the original file in place (simply by using [self fileURL] as the path, but the save operations are reported as failing to the user, since the temporary file is not being created.

Thanks,
Stephen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.