Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
How to extract files from zip archive?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to extract files from zip archive?



Hi All!

I need to extract zip-archive content to ~/Library/Application Support/My Program/Shared at the first launch.
What the best way to do it?


I tried to

NSString * listsPath = STR_ADDPATH([[NSBundle mainBundle] resourcePath], @"lists.zip");

if (0 == folderSize && FileTools::DoesFileExist(filesystem_rep(listsPath)))
{
NSTask * task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/bin/unzip"];
NSArray * args = [NSArray arrayWithObjects:@"-a ", listsPath, @" -d ", sharedPath, nil];
[task setArguments: args];
[task launch];
[task waitUntilExit];
int status = [task terminationStatus];
[task release];
if (status)
{
NSLog(@"Failed to unpack lists to %@", sharedPath);
}
}


but status is 10, I guess because spaces are in the path.

_______________________________________________

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




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.