On Apr 29, 2013, at 11:08 , Steve Mills <[email protected]> wrote:
> We just noticed something that is wrong. When our > saveToURL:ofType:forSaveOperation:completionHandler override gets called for > NSAutosaveElsewhereOperation on two different untitled docs, the url is > exactly the same, so the 2nd one overwrites the 1st. Why? How does Cocoa > formulate the url for untitled autosaved files? The autosaves I've seen use a URL in a temporary directory (with, essentially, a random directory name), but it constructs the file/package name by using a standard name containing a number that's incremented until it finds the first one for which no file already exists -- "(A document being autosaved by XXX)" is the starting name, then "(A document being autosaved by XXX 2)", followed by 3, 4, 5, etc. Since you're not creating anything there, I conclude, it always thinks the starting name is available, and re-uses it. > Keep in mind we have preservesVersions and autosavesInPlace both returning > NO. We've overridden saveToURL so we can direct autosaves to a folder > optionally set by the user. But the incoming url is the problem, before we've > even touched it. You should generate your own unique file name, then. There's no value in preserving the incoming file name anyway, is there, since you're returning a different URL, right? _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
