On 04/04/2008, Randall Meadows <[EMAIL PROTECTED]> wrote: > > So I wonder what your stringWithFormat results actually look like. > > > > Just as you'd expect; something like > > "/Users/randy/Desktop/file.tar" > > I did the stringWithFormat: merely to quote the path, but upon reading the > docs further, it appears this quoting is unnecessary, so I removed it and > just add the variables to the args array directly. I still get the > status=2. > > > > Hey wait... why does your tarFilePath end with a "/", > > > > I don't know what you mean...it doesn't. There are \ characters in the > code, they are merely to quote the double-quotes within the format string > for the compiler, but there are no trailing slashes. > > > > Do try the fileSystemRepresentation method :-) > > > > tarFilePath and plistPath are used extensively elsewhere as naked NSStrings > with no problem. But I tried, anyway. > > Since fSR returns a const char *, I had to wrap that in an NSString anway, > and the result looks *exactly* like the bare NSString to begin with. And > yes, the result of using fSR is: > > status=2 > > Still. :( >
Damn, missed the double quotes. :-) - Log your params and reproduce the full command in a Terminal window. - I don't think you have to worry about quoting your paths because NSTask takes care of that for you (i.e. it's NOT calling system() under the hood). - install an output pipe: NSPipe *pOutputPipe = nil; ... pOutputPipe = [NSPipe pipe]; [pNSTask setStandardOutput:pOutputPipe]; pOutputFileHandle = [pOutputPipe fileHandleForReading]; pResultsString = [[NSString alloc] initWithData:[pOutputFileHandle readDataToEndOfFile] encoding: NSUTF8StringEncoding]; NSLog( pResultsString ); [pResultsString release]; [Forgive the Hungarian notation, I kind of like it :-) Copied/pasted and unverified] Good luck. Cheers, -H. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]