On Mar 30, 2014, at 17:02 , Colas B <colasj...@yahoo.fr> wrote:

> With the  ‘NSFileWrapperWritingAtomic’ option, the "re-writing" goes well 
> (error = nil). With other options, the "re-writing" does not go well and 
> there is an error ("Error Domain=NSCocoaErrorDomain Code=516 "The file 
> “folderName” couldn’t be saved in the folder “Desktop” because a file with 
> the same name already exists." UserInfo=0x610000069c80 
> {NSFilePath=/Users/colas/Desktop/folderName, NSUnderlyingError=0x610000041e60 
> "The operation couldn’t be completed. File exists"}".

I don’t know the answer. It’s not clear from the documentation whether the 
‘writeToURL:’ method is supposed re-write an existing folder in place, or 
whether it’s correct to give the above error. (NSFileWrapper documentation is 
really lousy.)

It’s possible that it’s not supposed to. In that case, the fact that it does 
when ‘NSFileWrapperWritingAtomic’ is specified may be accidental. It’s possible 
that, when the option is *not* specified, you’re supposed to move the old 
top-level folder somewhere else and do the ‘writeToURL:’ specifying that 
“somewhere else” as the ‘originalURL’ parameter.

All I can say is that NSFileWrapper does what it does, and its API contract 
isn’t specific enough to allow us to deduce what it will do in any scenario.

_______________________________________________

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