I try concatenating files using the cat command. When I use this in the terminal, everything works fine :
cat /Users/Home/Desktop/test.mp3* > test.mp3
Trying to reproduce this using an NSTask, gives me the error below :
Code :
NSArray *Args = [NSArray arrayWithObjects:[NSString stringWithFormat:@"%@*",[TAFileName stringByDeletingPathExtension]],@">",[TAFileName stringByDeletingPathExtension],nil];
NSLog(@"%@",Args);
NSString *LaunchPath = [[NSBundle mainBundle] pathForResource:@"cat" ofType:@""];
[self startTaskWithLaunchPath:LaunchPath andArguments:Args showingProcess:NO];
NSLog output :
(
"/Users/Home/Desktop/test.mp3*",
">",
"/Users/Home/Desktop/test.mp3"
)
Error :
cat: /Users/Home/Desktop/test.mp3*: No such file or directory
cat: >: No such file or directory
cat: /Users/Home/Desktop/test.mp3: No such file or directory
The "startTaskWithLaunchPath: andArguments: showingProcess:" works fine with lots of other terminal commands, I'm 100% sure that's not the problem.