I'm using NSTask to spawn a process to do some work as per the code below:

-(void)downloadFile:(NSString *)downloadURL

{

 mode = @"download";


 downloadFilePath = [self generateUniqueTemporaryFileName];

 task = [[NSTask init] alloc];

[task setLaunchPath:@"/usr/bin/curl"];

[task setArguments:[NSArray arrayWithObjects:@"-s",

[NSString stringWithFormat:@"-o %@", [downloadFilePath lastPathComponent]],

downloadURL,

nil]

 ];

[task setCurrentDirectoryPath:[downloadFilePath
stringByDeletingLastPathComponent] ];

[task launch];

}


And I handle the notification as follows:


- (void)checkATaskStatus:(NSNotification *)aNotification {


 BOOL result = ([[aNotification object] terminationStatus] == 0);

if ([mode isEqualToString:@"download"]) {

[[self delegate] trackDidFinishDownload:downloadFilePath success:result];

} else if ([mode isEqualToString:@"upload"])  {

 }

 }


The problem is that in my delegate I can't access the file! Although I can
see it on the filesystem and open it. even if I check if the file exists
from the delegate, it gives me "false". Why is this happening? How can I fix
it
_______________________________________________

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

Reply via email to