Re: Terminate File Copy
Re: Terminate File Copy
- Subject: Re: Terminate File Copy
- From: "Alan Smith" <email@hidden>
- Date: Wed, 28 Jun 2006 11:12:14 -0400
Hmm. It isn't too obvious how to do this.
I have been working a lot with NSFileManager recently. First, it
would be a bad idea to stop a file copy. Because if the copy is, say,
half way done and it is stopped there will be a partial file left on
disk. Unless you delete that the disk will get fragmented quickly and
the end-user won't like this.
Why you would want to stop a file copy in mid stream is beyond me.
In fact, what you want to do doesn't seem possible. You won't get
control back until the copy of the current file is done. Thus, you
won't know to stop the transfer. I know little of threads so don't
quote me on this but perhaps you could put the copying of the current
file in another thread from the checking of the cancel button. This
way once the button is clicked you could terminate the copying thread,
stopping it in midstream.
If you do find a way to stop the transfer I *highly* recommend that
you delete the last file because it won't be a complete file. You
don't want to slow the OS because you stopped a file transfer.
Good luck, Alan
On 6/28/06, Aalok <email@hidden> wrote:
Hi,
In my application, I transfer files from mac to windows(smb). I
dispatch a separate thread to the transfer and my UI runs on the main
thread.
I have a Cancel functionality in the application. Now when a file is
under transfer
(using [fileManager copyPath:filePath toPath:destination handler:nil])
and I press cancel(I set a flag for that), the actual file transfer
doesn't stop for that file. The thread terminates after that file
transfer is complete. And it doesn't transfer anymore files.
I want the functionality which, on Cancel, terminates ongoing file
transfer also.
Is it possible? If there is some other approach to do that please advice.
regards,
aalok
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden