Re: Interrupt copyItemAtPath
Re: Interrupt copyItemAtPath
- Subject: Re: Interrupt copyItemAtPath
- From: "gMail.com" <email@hidden>
- Date: Mon, 08 Nov 2010 00:06:10 +0100
- Thread-topic: Interrupt copyItemAtPath
Great! It worked well. And it even deleted the file partially copied!
Thank you so much.
A quick question more please.
As I have seen on the Apple sample code "FSFileOperation",
I can wait until FSCopyObjectAsync is done, using CFRunLoopRunInMode.
while(!gFileCopiedDone && !mUserPressedStop){
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5.0, true);
}
if(mUserPressedStop){
FSFileOperationCancel(fileOp);
return -12;
}
The user can press a button and set mUserDidStop = YES;
and I set the gFileCopiedDone to YES in the callback method,
when stage == kFSOperationStageComplete
Since I have several files to copy, one by one, this way I can better manage
each single copy. Everything seems to work flawlessly. But, I ask, do you
think it's ok with the Mac standards? I mean, I have checked and the menu
works, the other apps work... Could this waiting loop cause some problem?
--
Leo
> Da: Sherm Pendley <email@hidden>
> Data: Sun, 7 Nov 2010 16:37:19 -0500
> A: "gMail.com" <email@hidden>
> Cc: Ken Thomases <email@hidden>, <email@hidden>
> Oggetto: Re: Interrupt copyItemAtPath
>
> On Sun, Nov 7, 2010 at 4:09 PM, gMail.com <email@hidden> wrote:
>
>> I have checked FSCopyObjectAsync and the copy works well.
>> I can get my callback function called so I can observe the working progress
>> as the kFSOperationBytesCompleteKey and kFSOperationTotalBytesKey and get
>> the kFSOperationStageComplete status. Well.
>>
>> But I can't figure out yet how to interrupt the copy.
>
> The first argument you pass to FSCopyObjectAsync() is an
> FSFileOperationRef that you created with FSFileOperationCreate(). Pass
> that same FSFileOperationRef to FSFileOperationCancel().
>
> sherm--
>
> --
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net
_______________________________________________
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