launch from NSTask

64 views
Skip to first unread message

Marco

unread,
Aug 21, 2007, 11:52:10 AM8/21/07
to xar-devel
Hi,
i'm trying to launch xar command from (Cocoa) NSTask.
It seems it doesn't accept the quote, neither with escape (\") or
single quote (',\',`).
The problem is when i pass an argument that contains a space, xar
recognises it like two arguments. The same if i put quote before and
after the argument.

Have you got any suggestions?

Marco

Rob Braun

unread,
Aug 21, 2007, 11:58:44 AM8/21/07
to xar-...@googlegroups.com
NSTask should take a list of arguments and no quoting should
be necessary unless your task is a shell. Perhaps if you
showed us the code causing the problem we could be of more help.

Thanks,
Rob

Marco

unread,
Aug 21, 2007, 12:06:16 PM8/21/07
to xar-devel
Here is the code:

task = [[NSTask alloc] init];
//set executable path
[task setLaunchPath:@"/usr/local/bin/xar"];
//set dir of files
[task setCurrentDirectoryPath:absolutePath];
[arguments addObject:@"-cf"];
[arguments addObject:destination];

//add files name
en = [arrayOfFiles objectEnumerator];
while(object = [en nextObject])
[arguments addObject:[object lastPathComponent]];

[task setArguments:arguments];
[task launch];

Marco

unread,
Sep 13, 2007, 7:09:18 PM9/13/07
to xar-devel
Hi,
i've found a problem in my code. Now it works, but it doesn't
recognize the parameter --exclude=".*/\..*".
I've also tried the strings:
@"--exclude=\".*/\\..*\""
@"--exclude=\".*/\..*\""
@"--exclude=\'.*/\\..*\'"
@"--exclude='.*/\\..*'"
@"--exclude='.*/\..*'"
but nothing is changed.

Thanks
Marco

Marco

unread,
Sep 15, 2007, 7:53:05 AM9/15/07
to xar-devel

Problem solved.
Just remove quoting from \".*/\\..*\"", so:

@"--exclude=.*/\\..*"

Marco

Reply all
Reply to author
Forward
0 new messages