ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/installer2/src/net/oni2/aeinstaller/backend/ToolLauncher.java
Revision: 672
Committed: Sat Feb 23 17:40:47 2013 UTC (12 years, 7 months ago) by alloc
Content type: text/x-java
File size: 1301 byte(s)
Log Message:
AEI2 0.99q:
- Updates dialog: Updating the to-download-size on (un)checking updates to download
- Updates dialog: Show download size of individual updates
- Tool execution: Support for .NET tools (Mod_Info.cfg added ExeType flag)
- Depot backend: Ignore mod nodes with an empty package number field

File Contents

# Content
1 package net.oni2.aeinstaller.backend;
2
3 import java.io.File;
4 import java.util.Vector;
5
6 import net.oni2.aeinstaller.backend.Settings.Platform;
7 import net.oni2.aeinstaller.backend.packages.Package;
8
9 /**
10 * @author Christian Illy
11 */
12 public class ToolLauncher {
13 /**
14 * @param p
15 * Package of tool to launch
16 * @throws Exception
17 * If a required runtime is not found
18 */
19 public static void launch(Package p) throws Exception {
20 File exe = p.getExeFile();
21
22 Vector<String> params = new Vector<String>();
23 switch (p.getExeType()) {
24 case OSBINARY:
25 break;
26 case DOTNET:
27 if (!DotNet.isInstalled())
28 throw new Exception(".NET not found");
29 if (Settings.getPlatform() != Platform.WIN) {
30 params.add(DotNet.getRuntimeExe());
31 }
32 break;
33 case JAR:
34 File jre = null;
35 if (Settings.getPlatform() == Platform.WIN)
36 jre = new File(System.getProperties().getProperty(
37 "java.home"), "bin/javaw.exe");
38 else
39 jre = new File(System.getProperties().getProperty(
40 "java.home"), "bin/java");
41 if (!jre.exists())
42 throw new Exception("JRE not found");
43 params.add(jre.getPath());
44 params.add("-jar");
45 break;
46 }
47 params.add(exe.getPath());
48
49 File wd = p.getWorkingDir();
50
51 AppExecution.execute(params, wd);
52 }
53 }