だから私は私のmacアプリでいくつかの基本的なターミナルコマンドを実行しようとしていますが、何らかの理由でそれを実行できません。
これが私のコードです:
NSString *commitText = [commitMessage stringValue];
NSString *a = [NSString stringWithFormat:@"cd %@", dirPath];
NSString *c = [NSString stringWithFormat:@"usr/bin/git commit -m '%@'", commitText];
NSTask *aTask = [[NSTask alloc] init];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:a];
[args addObject:@"git add *"];
[args addObject:c];
[args addObject:@"git push origin HEAD"];
NSPipe *pipe;
pipe = [NSPipe pipe];
[aTask setStandardOutput: pipe];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[aTask setLaunchPath:@"bin/sh"];
[aTask setArguments:args];
[aTask launch];
エラーは次のとおりです。
2012-06-09 15:18:50.293 Auto Git[9404:403] launch path not accessible
2012-06-09 15:18:50.297 Auto Git[9404:403] (
0 CoreFoundation 0x00007fff870b4f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff90e35d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff870b4d8a +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff870b4d14 +[NSException raise:format:] + 116
4 Foundation 0x00007fff9174f1f4 -[NSConcreteTask launchWithDictionary:] + 470
5 Auto Git 0x0000000109e1365d -[Push push:] + 765
6 CoreFoundation 0x00007fff870a470d -[NSObject performSelector:withObject:] + 61
7 AppKit 0x00007fff8e0f8f7e -[NSApplication sendAction:to:from:] + 139
8 AppKit 0x00007fff8e0f8eb2 -[NSControl sendAction:to:] + 88
9 AppKit 0x00007fff8e0f8ddd -[NSCell _sendActionFrom:] + 137
10 AppKit 0x00007fff8e0f82a0 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2014
11 AppKit 0x00007fff8e177fc4 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 489
12 AppKit 0x00007fff8e0f6eaa -[NSControl mouseDown:] + 786
13 AppKit 0x00007fff8e0c2348 -[NSWindow sendEvent:] + 6306
14 AppKit 0x00007fff8e05ba55 -[NSApplication sendEvent:] + 5593
15 AppKit 0x00007fff8dff20c6 -[NSApplication run] + 555
16 AppKit 0x00007fff8e26e244 NSApplicationMain + 867
17 Auto Git 0x0000000109e12eb2 main + 34
18 Auto Git 0x0000000109e12e84 start + 52
19 ??? 0x0000000000000003 0x0 + 3
)
私は何が間違っているのですか?助けてください。みんなありがとう。