• 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
NSTask & curl
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTask & curl


  • Subject: NSTask & curl
  • From: Ammar Ibrahim <email@hidden>
  • Date: Sun, 7 Jun 2009 00:18:48 +0300

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 (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

  • Follow-Ups:
    • Re: NSTask & curl
      • From: Nick Zitzmann <email@hidden>
    • Re: NSTask & curl
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Re: A couple questions about graphics
  • Next by Date: Re: crashing web browser with openURL call
  • Previous by thread: Re: crash in -[_NSArrayControllerTreeNode _safeNodeAtIndexPath:]
  • Next by thread: Re: NSTask & curl
  • Index(es):
    • Date
    • Thread