Re: How to extract files from zip archive?
Re: How to extract files from zip archive?
- Subject: Re: How to extract files from zip archive?
- From: Chris Hanson <email@hidden>
- Date: Mon, 30 May 2011 19:32:22 -0700
On May 30, 2011, at 8:45 AM, Vyacheslav Karamov wrote:
> NSString * listsPath = STR_ADDPATH([[NSBundle mainBundle] resourcePath], @"lists.zip");
What is STR_ADDPATH? There's already Cocoa API for what it looks like it does:
NSString *listsPath = [[NSBundle mainBundle] pathForResource:@"lists" ofType:@"zip"];
In general you shouldn't try to reinvent or wrap Cocoa's APIs.
> NSArray * args = [NSArray arrayWithObjects:@"-a ", listsPath, @" -d ", sharedPath, nil];
NSTask does not perform any shell interpretation on the arguments you give it; you do not need to use spaces, quotes, etc. in them.
This is general to Unix-based operating systems: Only a very few APIs (such as the system(3) function) do any sort of argument interpretation. In general, if you're dealing with an array of arguments, that's the array that will be copied (via the execve(2) or posix_spawn(2) functions) over to the other program's main() function.
-- Chris
_______________________________________________
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