Cocoa: Using UNIX based commands to write a file
Posted
by BryCry
on Stack Overflow
See other posts from Stack Overflow
or by BryCry
Published on 2010-05-14T16:34:12Z
Indexed on
2010/05/16
15:00 UTC
Read the original article
Hit count: 281
I'm looking for help with a program im making. I create a *.sh file as follows:
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];
This works, i get a file called exec.sh created in the location i craete with the destDirStr. Now is my next question, i need to get that file filled with the following:
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
The actual idea is that this script is written into the sh file, and all the _temp and other locations are replaced by the vars i get from textfields etc.
so c:\users\twan\desktop\pres_temp would be a var called tempDirStr that i get from my inputfields.
(i know these cmomands and locations are windows based, im doing this with a friend and he made a .net counterpart of the application.
Can you guys help me out?:D thanks in advance!
© Stack Overflow or respective owner