Re: NSTask with unzip

2010-12-12 Thread Torsten Curdt
On Sun, Dec 12, 2010 at 13:34, John C. Randolph wrote: > You don't need to launch a separate task for this.  Just use Pierre-Olivier > LaTour's NSData category: > > http://code.google.com/p/polkit/ Careful - that code is GPL licensed. ___ Cocoa-dev mai

Re: NSTask with unzip

2010-12-12 Thread John C. Randolph
You don't need to launch a separate task for this. Just use Pierre- Olivier LaTour's NSData category: http://code.google.com/p/polkit/ " • NSData+GZip adds gzip compression / decompression methods to NSData" -jcr ___ Cocoa-dev mailing list (Cocoa

Re: NSTask with unzip

2010-11-30 Thread Tim Schröder
a (not a zip file) to a NSData. > In other words, I have to zip and unzip "data to data", without using any > file. Some idea? > > -- Leonardo > > > >> Da: Ben Haller >> Data: Sun, 28 Nov 2010 08:52:33 -0500 >> A: Leonardo , Cocoa List >&g

Re: NSTask with unzip

2010-11-28 Thread Scott Ribe
On Nov 28, 2010, at 3:51 PM, Leonardo wrote: > > Great! Thanks for the advises. > Now I have to zip and unzip a NSData (not a zip file) to a NSData. > In other words, I have to zip and unzip "data to data", without using any > file. Some idea? Use zlib directly. It's not too hard to compress buff

Re: NSTask with unzip

2010-11-28 Thread Kyle Sluder
On Sun, Nov 28, 2010 at 3:12 PM, glenn andreas wrote: > A quick google search turns up several Cocoa zip frameworks out there that > will avoid having to use NSTask, etc... all together.  While the zip file > format is ugly, it is documented and you can always write your own to walk > through a

Re: NSTask with unzip

2010-11-28 Thread glenn andreas
On Nov 28, 2010, at 4:51 PM, Leonardo wrote: > Great! Thanks for the advises. > Now I have to zip and unzip a NSData (not a zip file) to a NSData. > In other words, I have to zip and unzip "data to data", without using any > file. Some idea? > > -- Leonardo A quick google search turns up sever

Re: NSTask with unzip

2010-11-28 Thread Leonardo
onardo , Cocoa List > Oggetto: Re: NSTask with unzip > > Yes, this looks good. I like your category on NSFileHandle (not a > subclass!); it's cleaner than the code at the link I sent you, since it > doesn't just eat the error, and it's better as a category. > >

Re: NSTask with unzip

2010-11-28 Thread Ben Haller
continue; >} >if (returnError) > *returnError = e; >return nil; >} >@throw; >} >} > } > @end > > >> Da: Ben Haller >> Data: Sat, 27 Nov 2010 12:

Re: NSTask with unzip

2010-11-27 Thread Leonardo
*returnError = e; return nil; } @throw; } } } @end > Da: Ben Haller > Data: Sat, 27 Nov 2010 12:12:39 -0500 > A: Dave DeLong > Cc: "gMail.com" , Cocoa List > > Oggetto: Re: NSTask with unzip > >

Re: NSTask with unzip

2010-11-27 Thread Dave DeLong
Something along the lines of: NSString * tempFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"myTempFile.tmp"]; if (![[NSFileManager defaultManager] fileExistsAtPath:tempFilePath]) { [[NSFileManager defaultManager] createFileAtPath:tempFilePath contents:nil attributes:nil];

Re: NSTask with unzip

2010-11-27 Thread gMail.com
a: Sat, 27 Nov 2010 08:48:34 -0800 > A: Ben Haller > Cc: "gMail.com" , Cocoa List > > Oggetto: Re: NSTask with unzip > > The way I get around this is to use an NSFileHandle for standard out instead > of an NSPipe. It's a bit less efficient, but slightly more conv

Re: NSTask with unzip

2010-11-27 Thread Dave DeLong
What Scott said. I use NSFileManager to create a file in NSTemporaryDirectory(), then point an NSFileHandle to that file for writing. That NSFileHandle becomes the standard out of the task, and all the output of the task is written to the file, which I can then peruse and reuse later at my co

Re: NSTask with unzip

2010-11-27 Thread Scott Ribe
On Nov 27, 2010, at 10:12 AM, Ben Haller wrote: > > NSPipe uses NSFileHandle. Does using an NSFileHandle directly change things > somehow? If so, why? NSPipe uses pipes, which act sort of like files, except for that buffering thing, enough so that they can be accessed through the same interfa

Re: NSTask with unzip

2010-11-27 Thread Ben Haller
Here's a post that I found useful: http://dev.notoptimal.net/2007/04/nstasks-nspipes-and-deadlocks-when.html Dave, not sure what you mean here. NSPipe uses NSFileHandle. Does using an NSFileHandle directly change things somehow? If so, why? I think this is an avenue I haven't explored;

Re: NSTask with unzip

2010-11-27 Thread Dave DeLong
The way I get around this is to use an NSFileHandle for standard out instead of an NSPipe. It's a bit less efficient, but slightly more convenient. Dave Sent from my iPhone On Nov 27, 2010, at 7:59 AM, Ben Haller wrote: > On 2010-11-26, at 7:33 AM, gMail.com wrote: > >> Hi, I can properly u

Re: NSTask with unzip

2010-11-27 Thread Ben Haller
On 2010-11-26, at 7:33 AM, gMail.com wrote: > Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip > The task saves the unzipped file to the disk, then a I read the unzipped > file in a NSData. Well. My question is: > Can I do the same job without saving the unzipped file to

NSTask with unzip

2010-11-26 Thread gMail.com
Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip The task saves the unzipped file to the disk, then a I read the unzipped file in a NSData. Well. My question is: Can I do the same job without saving the unzipped file to the disk? I have tried to set the standard output to