ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/src/net/oni2/aeinstaller/backend/oni/XMLTools.java
Revision: 708
Committed: Thu Mar 21 09:39:55 2013 UTC (12 years, 6 months ago) by alloc
Content type: text/x-java
File size: 1548 byte(s)
Log Message:
AEI2: Refactorings for breaking out independent features into libraries

File Contents

# Content
1 package net.oni2.aeinstaller.backend.oni;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.util.Vector;
6
7 import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
8 import net.oni2.aeinstaller.backend.DotNet;
9 import net.oni2.aeinstaller.backend.Paths;
10 import net.oni2.applicationinvoker.AppExecution;
11 import net.oni2.applicationinvoker.AppExecutionResult;
12
13 /**
14 * @author Christian Illy
15 */
16 public class XMLTools {
17
18 /**
19 * Patch the given XML file with the given patch
20 *
21 * @param patch
22 * Patchfile
23 * @param source
24 * File to patch
25 *
26 * @return XMLTools output
27 */
28 public static AppExecutionResult patch(File patch, File source) {
29 Vector<String> cmdLine = getProgramInvocation();
30 // xmlTools.exe patchfile -filename:PATCH -forceinfiles:TOPATCH
31 cmdLine.add("patchfile");
32 cmdLine.add("-filename:" + patch.getPath());
33 cmdLine.add("-forceinfiles:" + source.getPath());
34 AppExecutionResult res = null;
35 try {
36 res = AppExecution.executeAndWait(cmdLine);
37 } catch (IOException e) {
38 e.printStackTrace();
39 }
40 return res;
41 }
42
43 private static Vector<String> getProgramInvocation() {
44 Vector<String> res = new Vector<String>();
45 if (DotNet.getRuntimeExe().length() > 0)
46 res.add(DotNet.getRuntimeExe());
47 res.add(getProgramFile().getPath());
48 return res;
49 }
50
51 private static File getProgramFile() {
52 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), "Tools");
53 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, "xmlTools.exe");
54 }
55 }