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

Last change on this file since 703 was 702, checked in by alloc, 12 years ago

AEI2 0.99u:

  • Fixed a few bugs in apply patches
  • Added some log output to apply patches
File size: 1.5 KB
RevLine 
[698]1package net.oni2.aeinstaller.backend.oni;
2
3import java.io.File;
4import java.io.IOException;
5import java.util.Vector;
6
[699]7import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
[698]8import net.oni2.aeinstaller.backend.DotNet;
9import net.oni2.aeinstaller.backend.Paths;
[702]10import net.oni2.aeinstaller.backend.appexecution.AppExecution;
11import net.oni2.aeinstaller.backend.appexecution.AppExecutionResult;
[698]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 */
[702]28 public static AppExecutionResult patch(File patch, File source) {
[698]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());
[702]34 AppExecutionResult res = null;
[698]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() {
[699]52 File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(Paths.getEditionBasePath(), "Tools");
53 return CaseInsensitiveFile.getCaseInsensitiveFile(toolsPath, "xmlTools.exe");
[698]54 }
55}
Note: See TracBrowser for help on using the repository browser.