NSDocument: Read-only types and autosavesInPlace
NSDocument: Read-only types and autosavesInPlace
- Subject: NSDocument: Read-only types and autosavesInPlace
- From: Daniel Vollmer <email@hidden>
- Date: Fri, 22 Jul 2011 18:16:38 +0200
Hello,
I'm trying to add autosavesInPlace support to my NSDocument-based Application. It supports a read-only type that is internally converted (as suggested in https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Documents/Tasks/FAQ.html#//apple_ref/doc/uid/20000954-1081265-BAJFDEGD) to my writable type.
The viewer- and editor-roles are set correctly in the application's plist, +writableTypes also returns only what I can write. For reference, I can read .txt and read/write .wowplot.
Now, this seems to interact badly with autosavesInPlace: YES. The following happens:
1) I open a document of the read-only type (.txt)
2) I convert this as suggested above to my writable type, using setFileType and setFileURL
3) I modify the document
4) I attempt to close the document
5) Now the autosave-Machinery jumps into action and I get the following error:
[ERROR] genstore_storage.c:GSAddPathAsGeneration:980 copyfile "/Volumes/Seerose/Users/maven/Desktop/110720 225338.wowplot" to "/Volumes/Seerose/Users/maven/Library/Autosave Information/2521980F-37BC-4E21-AF6A-001BE638AEFC.genstore.noindex/.genstore_staging/OUyU4Xi/staged" failed with error 2 (No such file or directory)
The errors make sense, as the file under that name never existed.
Now I'm stuck in-between a rock in a hard place:
If I change the type, autosavesInPlace tries to duplicate a non-existent file (because I modified the fileURL); if I don't change the type, NSDocument will ask me to write a file of a type I cannot support.
Any ideas?
Thanks,
Daniel.
_______________________________________________
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