On May 27, 2010, at 6:55 AM, Antonio Nunes wrote: > Thanks so much for the elaborate and pertinent answer Ken. You are right. I > was not passing the arguments correctly to the task.
You're welcome. Glad I could help. > I was creating the arguments like this: > > [args addObject:[NSString stringWithFormat:@"-f \"%...@\"", > [[sourceDirectoryURL path] stringByAppendingPathComponent:sourceFileName]]]; > > Whereas, I now understand (hopefully correctly), I should have been creating > them like this: > > [args addObject:[NSString stringWithFormat:@"-f%@", [[sourceDirectoryURL > path] stringByAppendingPathComponent:sourceFileName]]]; > Yes. Now that I pass the option's identifier with its parameter appended > snugly to it (without quotes and separating space char) the URL is created > correctly. Well, that works, but I want to clarify something... If, in a shell, you were to invoke a command like: /path/to/some/command -f /path/to/file Then the program would receive "-f" and "/path/to/file" as separate arguments. To achieve the same thing with NSTask, you'd pass @"-f" and @"/path/to/file" as two separate elements of the argument array. You've now switched to the equivalent of: /path/to/some/command -f/path/to/file That works in this case, but relies on the program you're invoking parsing apart the option switch from its value. Apparently, that assumption holds for the program in question. I just wanted to make sure you understood how to replicate the original form using NSTask. Cheers, Ken _______________________________________________ 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 arch...@mail-archive.com