Editing files in place using NSDocument
Editing files in place using NSDocument
- Subject: Editing files in place using NSDocument
- From: "Stephen F. Booth" <email@hidden>
- Date: Thu, 16 Feb 2006 16:50:59 -0800
I would like to edit a portion of a file's data in place
(specifically the tags inside a FLAC file) using the NSDocument
architecture. I have successfully overridden
- (BOOL) readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
error:(NSError **)outError
to read in the metadata. I have tried overriding
- (BOOL) writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
forSaveOperation:(NSSaveOperationType)saveOperation
originalContentsURL:(NSURL *)absoluteOriginalContentsURL error:
(NSError **)outError
for writing the modified metadata to absoluteOriginalContentsURL.
The file is indeed modified and saved (correctly) on disk, but the
save operation fails and displays an error sheet. I believe this is
because the application wants the NSDocument's data to be written to
absoluteURL, which is something like "/tmp/501/Tag_X" (whereas
absoluteOriginalContentsURL is "/tmp/foo.flac"). However, I
obviously don't want to have to deal with copying megabytes of FLAC
data to absoluteURL only to have it copied back to the original.
Does anyone have ideas/sample code/something I've missed?
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:
This email sent to email@hidden