[698] | 1 | package net.oni2.aeinstaller.backend.oni;
|
---|
| 2 |
|
---|
| 3 | import java.io.File;
|
---|
| 4 | import java.io.IOException;
|
---|
| 5 | import java.util.Vector;
|
---|
| 6 |
|
---|
[699] | 7 | import net.oni2.aeinstaller.backend.CaseInsensitiveFile;
|
---|
[698] | 8 | import net.oni2.aeinstaller.backend.Paths;
|
---|
[924] | 9 | import net.oni2.platformtools.PlatformInformation;
|
---|
[720] | 10 | import net.oni2.platformtools.applicationinvoker.ApplicationInvoker;
|
---|
| 11 | import net.oni2.platformtools.applicationinvoker.ApplicationInvocationResult;
|
---|
| 12 | import net.oni2.platformtools.applicationinvoker.EExeType;
|
---|
| 13 | import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException;
|
---|
[698] | 14 |
|
---|
| 15 | /**
|
---|
| 16 | * @author Christian Illy
|
---|
| 17 | */
|
---|
| 18 | public class XMLTools {
|
---|
| 19 |
|
---|
| 20 | /**
|
---|
[925] | 21 | * Patch XML files with the given patch list
|
---|
[698] | 22 | *
|
---|
[925] | 23 | * @param patch
|
---|
| 24 | * Patchlist file
|
---|
[698] | 25 | *
|
---|
| 26 | * @return XMLTools output
|
---|
| 27 | */
|
---|
[925] | 28 | public static ApplicationInvocationResult patch(File patch) {
|
---|
[720] | 29 | Vector<String> params = new Vector<String>();
|
---|
[937] | 30 | params.add("--aei-patch-files-list");
|
---|
| 31 | params.add(patch.getPath());
|
---|
[720] | 32 | ApplicationInvocationResult res = null;
|
---|
[698] | 33 | try {
|
---|
[924] | 34 | res = ApplicationInvoker.executeAndWait(EExeType.OSBINARY, null,
|
---|
[767] | 35 | getProgramFile(), params, false);
|
---|
[698] | 36 | } catch (IOException e) {
|
---|
| 37 | e.printStackTrace();
|
---|
[720] | 38 | } catch (ERuntimeNotInstalledException e) {
|
---|
| 39 | e.printStackTrace();
|
---|
[698] | 40 | }
|
---|
| 41 | return res;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | private static File getProgramFile() {
|
---|
[720] | 45 | File toolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(
|
---|
| 46 | Paths.getEditionBasePath(), "Tools");
|
---|
[924] | 47 | File xmlToolsPath = CaseInsensitiveFile.getCaseInsensitiveFile(
|
---|
| 48 | toolsPath, "XmlTools");
|
---|
| 49 | switch (PlatformInformation.getPlatform()) {
|
---|
| 50 | case WIN:
|
---|
| 51 | return CaseInsensitiveFile.getCaseInsensitiveFile(xmlToolsPath,
|
---|
| 52 | "XmlTools.exe");
|
---|
| 53 | case LINUX:
|
---|
| 54 | case MACOS:
|
---|
| 55 | return CaseInsensitiveFile.getCaseInsensitiveFile(xmlToolsPath,
|
---|
| 56 | "XmlTools");
|
---|
| 57 | default:
|
---|
| 58 | }
|
---|
| 59 | return null;
|
---|
[698] | 60 | }
|
---|
| 61 | }
|
---|