Cocoa デスクトップ アプリで Cordova プロジェクトを作成するコマンドを実行しようとしていますが、うまくいきません。
それが私のコードです:
NSTask *task = [NSTask new];
[task setLaunchPath:@"/Documents/Cordova/bin/ ./create ~/Documents/Cordova/HelloWorld2 org.apache.cordova.HelloWorld2 HelloWorld2"];
[task setArguments:[NSArray arrayWithObjects:@"-l", @"-a", @"-t", nil]];
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
[task launch];
NSData *data = [[pipe fileHandleForReading] readDataToEndOfFile];
[task waitUntilExit];
// [task release];
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog (@"got\n%@", string);
そして、それが出力です:
2013-04-02 23:48:18.968 Phonegap-ProjectCreator[2209:303] launch path not accessible
2013-04-02 23:48:18.970 Phonegap-ProjectCreator[2209:303] (
0 CoreFoundation 0x00007fff8b2b80a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff88d7e3f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8b2b7e7c +[NSException raise:format:] + 204
3 Foundation 0x00007fff8bd21cd2 -[NSConcreteTask launchWithDictionary:] + 409
4 Phonegap-ProjectCreator 0x0000000100002a4a -[MainWindow createProject:] + 314
5 AppKit 0x00007fff94506a59 -[NSApplication sendAction:to:from:] + 342
6 AppKit 0x00007fff945068b7 -[NSControl sendAction:to:] + 85
7 AppKit 0x00007fff945067eb -[NSCell _sendActionFrom:] + 138
8 AppKit 0x00007fff94504cd3 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 1855
9 AppKit 0x00007fff94504521 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 504
10 AppKit 0x00007fff94503c9c -[NSControl mouseDown:] + 820
11 AppKit 0x00007fff944fb60e -[NSWindow sendEvent:] + 6853
12 AppKit 0x00007fff944f7744 -[NSApplication sendEvent:] + 5761
13 AppKit 0x00007fff9440d2fa -[NSApplication run] + 636
14 AppKit 0x00007fff943b1cb6 NSApplicationMain + 869
15 Phonegap-ProjectCreator 0x00000001000011d2 main + 34
16 libdyld.dylib 0x00007fff89ced7e1 start + 0
17 ??? 0x0000000000000003 0x0 + 3
)
わからない 何が問題なの?実行するためのパスが見つからないか、実行できませんか?