source: AE/installer2/src/net/oni2/aeinstaller/backend/oni/XMLTools.java@ 709

Last change on this file since 709 was 708, checked in by alloc, 12 years ago

AEI2: Refactorings for breaking out independent features into libraries

File size: 1.5 KB
Line 
1package net.oni2.aeinstaller.backend.oni;
2
3import java.io.File;
4import java.io.IOException;
5import java.util.Vector;
6
7import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
8import net.oni2.aeinstaller.backend.DotNet;
9import net.oni2.aeinstaller.backend.Paths;
10import net.oni2.applicationinvoker.AppExecution;
11import net.oni2.applicationinvoker.AppExecutionResult;
12
13/**
14 * @author Christian Illy
15 */
16public 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}
Note: See TracBrowser for help on using the repository browser.