• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple untitled docs are saving to same file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple untitled docs are saving to same file


  • Subject: Re: Multiple untitled docs are saving to same file
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 29 Apr 2013 15:21:08 -0700

On Apr 29, 2013, at 11:08 , Steve Mills <email@hidden> 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@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

  • Follow-Ups:
    • Re: Multiple untitled docs are saving to same file
      • From: Jerry Krinock <email@hidden>
References: 
 >Multiple untitled docs are saving to same file (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Multiple untitled docs are saving to same file
  • Next by Date: Form sheet not returning to center after dismissal
  • Previous by thread: Re: Multiple untitled docs are saving to same file
  • Next by thread: Re: Multiple untitled docs are saving to same file
  • Index(es):
    • Date
    • Thread