• 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
Re: How to extract files from zip archive?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to extract files from zip archive?


  • Subject: Re: How to extract files from zip archive?
  • From: Lee Ann Rucker <email@hidden>
  • Date: Mon, 30 May 2011 09:34:29 -0700 (PDT)

>    NSArray * args = [NSArray arrayWithObjects:@"-a ", listsPath, @" -d
", sharedPath, nil];

Why do you have spaces in your args? It's not going to concatenate them into a single command line string, it's going to pass them in as the separate args to the app's "main".

----- Original Message -----
From: "Vyacheslav Karamov" <email@hidden>
To: email@hidden
Sent: Monday, May 30, 2011 8:45:51 AM
Subject: 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
_______________________________________________

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

References: 
 >How to extract files from zip archive? (From: Vyacheslav Karamov <email@hidden>)

  • Prev by Date: Re: How to intercepting click on send in Mail.app
  • Next by Date: Re: Linearly Scaling Text
  • Previous by thread: How to extract files from zip archive?
  • Next by thread: Re: How to extract files from zip archive?
  • Index(es):
    • Date
    • Thread