• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Async File Copying?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Async File Copying?


  • Subject: Re: Async File Copying?
  • From: Fawzi Mohamed <email@hidden>
  • Date: Thu, 17 May 2001 09:24:08 +0200

try to spawn a thread that makes the copy:
[NSThread detachNewThreadSelector:@selector(doTheCopy:)
toTarget:myCopyObject
withObject:myObjectWithInputParams];

then in the method
- (void)doTheCopy:(NSDictionary *)params;
you would call
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceCopyOperation ....]

I forgot to say that you should set up an autorelease pool in it to avoid leaks:

- (void)doTheCopy:(NSDictionary *)params
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceCopyOperation ....];
[pool release];
}


fawzi

On Thursday, May 17, 2001, at 07:27 AM, Steve Gehrman wrote:

I've tried both:

[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceCopyOperation ....]

and

[[NSFileManager defaultManager] copyPath ... ]

and both of them copy files synchronously (spinning rainbow until copy is done). Is there any easy way to do a asynchronous file copy besides writing it all from scratch?

steve
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Prev by Date: Re: Async File Copying?
  • Next by Date: Re: Cocoa CGI
  • Previous by thread: Re: Async File Copying?
  • Next by thread: NSOpenGLView and ATIR128Pro OpenGL Driver
  • Index(es):
    • Date
    • Thread