-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathUninstallProject.java
More file actions
67 lines (57 loc) · 1.6 KB
/
Copy pathUninstallProject.java
File metadata and controls
67 lines (57 loc) · 1.6 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
package javaforce.utils;
import java.io.*;
import javaforce.*;
/** Uninstall Project files.
*
* @author pquiring
*/
public class UninstallProject implements ShellProcessListener {
private BuildTools tools;
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage:UninstallProject build.xml");
System.exit(1);
}
try {
new UninstallProject().run(args[0]);
} catch (Exception e) {
JFLog.log(e);
}
}
public void run(String buildfile) throws Exception {
tools = new BuildTools();
if (!tools.loadXML(buildfile)) throw new Exception("error loading " + buildfile);
String app = tools.getProperty("app");
String apptype = tools.getProperty("apptype");
//delete /usr/bin/${app}
new File("/usr/bin/" + app).delete();
//read files.lst and delete them all
try {
File files = new File("files.lst");
if (files.exists()) {
FileInputStream fis = new FileInputStream(files);
byte[] lst = fis.readAllBytes();
String[] lns = new String(lst).replaceAll("\r","").split("\n");
for(String ln : lns) {
if (ln.length() == 0) continue;
File file = new File(ln);
if (file.exists()) {
file.delete();
}
}
}
} catch (Exception e) {
JFLog.log(e);
}
doSubProjects();
}
public void shellProcessOutput(String str) {
System.out.print(str);
}
private void doSubProjects() {
String[] subs = tools.getSubProjects();
for(String project : subs) {
main(new String[] {project + ".xml"});
}
}
}