On Mar 25, 2011, at 12:13, Sean McBride wrote:

> On Fri, 25 Mar 2011 12:08:53 -0700, Laurent Daudelin said:
> 
>> If that makes any difference, I'm running the copy method from an
>> NSOperation but each copy is done sequentially. I thought about creating
>> one NSOperation for each item to copy in a given folder but thought that
>> was many not very wise.
> 
> Maybe you're seeing a weirdo threading bug, what if you try everything
> on the main thread?

I just completed various runs using the 3 different APIs: 
"copyItemAtPath:toPath:error:", "copyPath:toPath:handler:" and 
"FSCopyObjectSync".

In order of reliability, for those interested, from the most reliable to the 
most unreliable:

1. "copyPath:toPath:handler:", leaves usually less than 5 files with incorrect 
modification dates.
2. "FSCopyObjectSync", leaves usually between 10 and 20 files with incorrect 
modification dates.
3. "copyItemAtPath:toPath:error:", the worst of all: out of 1060 items to copy, 
leaves 834 with incorrect modification dates. However, it's consistent. From 
what I can tell observing over 800 different items, it's always the same items 
that have incorrect modifications dates.

Another thing I did notice. Since I want this copy operation reliable and 
depend on the modification dates being set properly, after the copy, I run a 
few NSOperations to fix those modification dates using FSSetCatalogInfo(). 
After that fix (which amazingly doesn't raise any error when it cannot set the 
creation and modification dates of a file), I still get files that have their 
modification dates incorrect! What I did observe after several run is that some 
copy methods seem to "leave" the copied items in better "shape" than others 
when I apply the FSSetCatalogInfo() to those. Again, here is a score after 
several runs of the copy API that perform the best to the worst for the 
FSSetCatalogInfo:

FSCopyObjectSync: 1 file after using FSSetCatalogInfo() still remains with 
incorrect modification date.
"copyItemAtPath:toPath:error:": 1 file after using FSSetCatalogInfo() still 
remains with incorrect modification date.
"copyPath:toPath:handler:": no file after using FSSetCatalogInfo() to fix 
incorrect modification dates.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin                                 
http://www.nemesys-soft.com/
Logiciels Nemesys Software                                      
[email protected]_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to