Re: NSTask & curl
Re: NSTask & curl
- Subject: Re: NSTask & curl
- From: Michael Ash <email@hidden>
- Date: Sat, 6 Jun 2009 18:36:59 -0400
On Sat, Jun 6, 2009 at 6:05 PM, Ammar Ibrahim<email@hidden> wrote:
> On Sun, Jun 7, 2009 at 12:29 AM, Andrew Farmer <email@hidden> wrote:
>
>> On 6 Jun 2009, at 14:18, Ammar Ibrahim wrote:
>>
>>> I'm using NSTask to spawn a process to do some work as per the code below:
>>>
>>> <snip>
>>
>>> [task setLaunchPath:@"/usr/bin/curl"];
>>>
>>
>> Why on earth are you shelling out to do that? NSURLDownload exists for a
>> reason.
>>
>> In any case, the reason you aren't ending up with a file where you expect
>> it is this:
>>
>> [NSString stringWithFormat:@"-o %@", [downloadFilePath
>>> lastPathComponent]],
>>>
>>
>> Given downloadFilePath /foo/bar/baz, this'll create a file called " baz" -
>> with a leading space. Either use "-o%@" or use two separate arguments.
>
>
> Thanks that fixed it! Although when you call it directly from the command
> line, it's fine to have the space there!
Yes, you can. The command line is not the same as NSTask. Before you
do anything more with NSTask, or indeed UNIX in general, you ought to
read this:
http://cocoadev.com/index.pl?NSTaskArguments
Mike
_______________________________________________
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