On 20 Apr 2013, at 04:17, Steve Mills <smi...@makemusic.com> wrote:

> On Apr 19, 2013, at 16:51:20, Jerry Krinock <je...@ieee.org>
> wrote:
> 
>> Maybe you Steve and Alex Zavatone may be on to something there.  You're 
>> suggesting that, rather than handling the autosave when it is requested 
>> during a long-winded operation, you turn autosave off *before* the 
>> long-winded operation begins, so that you won't get any such requests.
> 
> Exactly, and it seems like such a basic part of the entire autosave concept 
> that it's amazing Apple didn't build it in from the start.

Arguably they did! But that they did it by making periodic autosaves something 
your app can bail out of if it wishes, rather than have to explicitly tell the 
system to disable autosaving up-front. Two benefits come to mind:

1) It's a little more flexible. Your app can test for conditions on-demand. If 
it's not condition that can be easily detected when it becomes true, this 
avoids polling for it

2) Removes the danger that a developer might make a mistake that accidentally 
causes autosaving to never be re-enabled. I can easily imagine an unexpected 
exception triggering this, or some particular edge case in an if statement.
> 
>> The problem with that is that the way you turn autosave off is by returning 
>> NO from +autosavesInPlace, which is a class method.  I ask then: Why did 
>> Apple make +autosavesInPlace a class method, other than to make it difficult 
>> to change on the fly?  You could do it with a static or global variable, I 
>> guess.  Your results will definitely be interesting.  Let us know what 
>> happens.
> 
> Actually, I believe you're mistaken. autosaveInPlace merely tells autosave 
> that, if turned on, it should replace the actual file once the autosave has 
> completed successfully. If it's off, autosaves are stored elsewhere in a 
> folder of NSDocument's choosing. The way to turn autosave on or off is 
> through NSDocumentController's setAutosavingDelay method, where 0 means off. 
> But, doing so doesn't seem to affect open documents if they've already 
> scheduled an autosave (seems like a bug to me - turning it off from here 
> should turn it off everywhere).

+autosavesInPlace controls whether to use the old or new document-saving model. 
This is primarily about how your users interact with the app. I'm pretty sure 
the document system is not designed to have this change underneath it while the 
app is running.

If for some reason you choose the old saving model, then 
NSDocumentController.autosavingDelay controls whether autosaves should be 
performed, and how frequently. I believe it has no effect whatsoever when the 
new document-saving model is in use.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to