Re: Problematic NSTask issue
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