gMail.com <mailto:mac.iphone....@gmail.com> wrote (Saturday,
November 6, 2010 3:27 PM +0100):
I copy a 14GB file with
- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath
error:(NSError **)error
Since the copy could take several minutes, I would grant the user the
opportunity to interrupt the copy pressing a given button.
Is a way to tell copyItemAtPath to break the job and return?
Maybe something similar to a delegate method like shouldProceedAfterError,
but occurring at any chunk copied?
Or should I use the latest methods from FSCopyObject.c ?
A couple of years ago I used FSCopyObject.c to copy files (and I added the
way to break the copy at a given moment), but as I recall, that code (I
think from the year 2002) didn't copy metadata, the BSD flags, the ACL
attributes and ACL Extended attributes. Is an updated version of this code?
I think the function you're probably interested in is
FSCopyObjectAsync(). You'll provide a callback function and a
minimum time interval between callbacks (this will require a run
loop). In your callback function, call FSFileOperationCancel()
to stop an in-progress file copy.
This is all a thoroughly modern API. These functions are built
on the same basic file copy mechanism used by the Finder. They
do "all the right things," including copying all metadata and
even tricks like detecting when the source and destination files
are on the same remote file server volume and having the remote
file server perform the copy locally.
--
James Bucanek
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com