views:

56

answers:

1

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!

A: 
NSString *scriptFile = [NSString stringWithFormat:@"svn co %@ %@ \ncd %@ \nsvn log -v --xml > logfile.log \ncd %@\ncp %@ %@ \njava -jar %@/statsvn.jar %@/logfile.log %@ \nrm -r -f %@\nrm statsvn.jar", svnURLStr, tempLocStr, tempLocStr, destDirStr, SVNStatStr, destDirStr, destDirStr, tempLocStr, tempLocStr, tempLocStr, nil];   

did the trick, thanks guys for the -[NSString writeToFile] method,it worked like a charm!

BryCry