Repository navigation
Expand file tree
/
Copy pathBatchGen.java
More file actions
137 lines (119 loc) · 2.89 KB
/
Copy pathBatchGen.java
File metadata and controls
137 lines (119 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package shellScriptGen.shells;
/**
* This is the extension of the shell base that generates windows batch
* files. I didn't believe there to be multiple flavors of windows batch files so
* I didn't create a windows base that is later subclassed like the UNIX shell base case.
*
* @author Amit Nithian ([email protected])
*
*/
public class BatchGen implements ShellScriptInterface
{
public String getComment()
{
// TODO Auto-generated method stub
return "REM";
}
public String getCPSeparator()
{
// TODO Auto-generated method stub
return ";";
}
public String getFileExtension()
{
// TODO Auto-generated method stub
return ".bat";
}
public String getScriptLine()
{
// TODO Auto-generated method stub
return "@echo off";
}
public String getExecuteScriptLine(String pScriptToExec)
{
// TODO Auto-generated method stub
return "call " + pScriptToExec;
}
public String createVariableDeclaration(String pName, String pValue)
{
// TODO Auto-generated method stub
return "set " + pName + "=\"" + pValue + "\"";
}
public String getVariableReference(String pVariableName)
{
// TODO Auto-generated method stub
return "%" + pVariableName + "%";
}
@Override
public String getFileSeparator()
{
// TODO Auto-generated method stub
return "\\";
}
/*
@Override
protected void buildPreLaunchScript()
{
// TODO Auto-generated method stub
File fPreLaunch = getFile("preLaunch.bat");
try
{
if(fPreLaunch.createNewFile())
{
addFileToFinishMessage(fPreLaunch);
}
}
catch(IOException p_ioe)
{
p_ioe.printStackTrace();
}
}
@Override
protected void buildMainShellScript(ILaunchConfiguration pConfig)
{
// TODO Auto-generated method stub
try
{
StringBuffer sJavaLine = new StringBuffer();
File fScript= getFile(pConfig.getName() + ".bat");
PrintWriter pWriter = new PrintWriter(new FileWriter(fScript));
pWriter.println("call preLaunch.bat");
pWriter.println("set CP=" + getClassPath());
sJavaLine.append("java -cp %CP% ");
sJavaLine.append(getJavaCommand(pConfig));
pWriter.println(sJavaLine.toString());
pWriter.println("call postLaunch.bat");
pWriter.flush();
pWriter.close();
addFileToFinishMessage(fScript);
}
catch(IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch(CoreException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void buildPostLaunchScript()
{
// TODO Auto-generated method stub
File fPreLaunch = getFile("postLaunch.bat");
try
{
if(fPreLaunch.createNewFile())
{
addFileToFinishMessage(fPreLaunch);
}
}
catch(IOException p_ioe)
{
p_ioe.printStackTrace();
}
}
*/
}