• 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: Problematic NSTask issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problematic NSTask issue


  • Subject: Re: Problematic NSTask issue
  • From: Nir Soffer <email@hidden>
  • Date: Tue, 4 Dec 2007 17:34:56 +0200


On Dec 4, 2007, at 16:37, Aaron Vegh wrote:

But then, I want to unzip it. Here's my code:

	NSTask *backupTask = [[NSTask alloc] init];
	[backupTask setLaunchPath:@"/usr/bin/unzip"];
	[backupTask setArguments:
	 [NSArray arrayWithObjects:file, nil]];

	// Launch it and wait for execution
	[backupTask launch];
	[backupTask waitUntilExit];

And it errors out with a message from unzip saying it can't find the file:

unzip:  cannot find or open '/Users/aaron/TestDir/picture.enc',
'/Users/aaron/TestDir/picture.enc'.zip or
'/Users/aaron/TestDir/picture.enc'.ZIP.

'/Users/aaron/TestDir/picture.enc' is the file it should be unzipping.
It's there, I swear! And it's a zipped file; I can change its
extension in the Finder to .zip and double-click it, no problem.

Is your "file" argument a quoted string?

If you are trying to send the argument "/Foo Bar Baz", you should use @"/Foo Bar Baz". @"'/Foo Bar Baz'" is a different file. NSTask is not a shell, you do not need to quote stuff because it does this for you if needed.


Best Regards,

Nir Soffer

_______________________________________________

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


  • Follow-Ups:
    • Re: Problematic NSTask issue
      • From: "Aaron Vegh" <email@hidden>
References: 
 >Problematic NSTask issue (From: "Aaron Vegh" <email@hidden>)

  • Prev by Date: Re: cut strech new Bitmap
  • Next by Date: Re: cut strech new Bitmap
  • Previous by thread: Problematic NSTask issue
  • Next by thread: Re: Problematic NSTask issue
  • Index(es):
    • Date
    • Thread