-1
我正在尋找一個即時編程的幫助。 我創建一個* sh文件如下:Cocoa:使用基於UNIX的命令來編寫文件
SVN_StatGenAppDelegate.h:
NSWindow *window;
NSTask *touch;
NSArray *touchArguments;
NSString *svnURLStr;
NSString *SVNStatStr;
NSString *destDirStr;
SVN_StatGenApplDelegate.m:
NSString *locationStr = [NSString stringWithFormat:@"%@/exec.sh", destDirStr];
NSLog(@"%@", locationStr);
touch = [[NSTask alloc] init];
[touch setLaunchPath:@"/usr/bin/touch"];
touchArguments = [NSArray arrayWithObjects:locationStr, nil];
[touch setArguments:touchArguments];
[touch launch];
這工作,我得到了一個名爲exec.sh中創建文件我用destDirStr craete的位置。 現在是我的下一個問題,我需要得到充滿了文件中的以下內容:
svn co http://repo.com/svn/test C:\users\twan\desktop\pres\_temp
cd C:\users\twan\desktop\pres\_temp
svn log -v --xml > logfile.log
copy C:\users\twan\desktop\statsvn.jar C:\users\twan\desktop\pres\_temp
cd ..
java -jar _temp\statsvn.jar C:\users\twan\desktop\pres\_temp/logfile.log C:\users\twan\desktop\pres\_temp
rmdir /s /Q _temp
實際的想法是,這個腳本寫入SH文件,所有的_temp等位置被替換\ USERS \ TWAN \桌面\ pres_temp將是一個變種稱爲tempDirStr,我從我的inputfields得到:瓦爾我從文本框等
所以C得到。
(我知道這些cmomands和位置是基於Windows,即時通訊和朋友這樣做的,他做了應用程序的.NET版本
你們能幫助我。?d 在此先感謝!
爲什麼你就不能使用' - [的NSString將writeToFile:原子性:編碼:錯誤: ]'? – 2010-05-15 02:02:49
是的,你不需要NSTask這一切。 – 2010-05-15 06:20:29
林去採取linto writeToFile方法,也許這就是我要找的。 我八九不離十新的可可(和Objective-C)所以..即時通訊只是想拉一些東西,P 感謝您的答覆,我也會看看 – Craimasjien 2010-05-15 16:03:58