ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/src/net/oni2/aeinstaller/backend/oni/XMLTools.java
Revision: 699
Committed: Sun Mar 17 17:52:08 2013 UTC (12 years, 6 months ago) by alloc
Content type: text/x-java
File size: 1486 byte(s)
Log Message:
AEI2 0.99t:
- Access to files/folders which can be different in case because of user interaction are now case insensitive
- Few cleanups

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