ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/backend/oni/OniLauncher.java
Revision: 772
Committed: Mon Apr 1 00:12:20 2013 UTC (12 years, 7 months ago) by alloc
Content type: text/x-java
File size: 1717 byte(s)
Log Message:
AEI2.00:
- Version
- Main win default size

File Contents

# Content
1 package net.oni2.aeinstaller.backend.oni;
2
3 import java.io.File;
4 import java.io.FileNotFoundException;
5 import java.util.Vector;
6
7 import net.oni2.aeinstaller.backend.Paths;
8 import net.oni2.platformtools.PlatformInformation;
9 import net.oni2.platformtools.applicationinvoker.ApplicationInvoker;
10 import net.oni2.platformtools.applicationinvoker.EExeType;
11 import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException;
12
13 /**
14 * @author Christian Illy
15 */
16 public class OniLauncher {
17
18 private static File getOniExe() throws FileNotFoundException {
19 File exe = null;
20 switch (PlatformInformation.getPlatform()) {
21 case WIN:
22 case LINUX:
23 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
24 break;
25 case MACOS:
26 exe = new File("./Oni.app/Contents/MacOS/Oni");
27 break;
28 default:
29 }
30 if (exe.exists())
31 return exe;
32 else
33 throw new FileNotFoundException(
34 "Oni's executable was not found");
35 }
36
37 private static EExeType getOniExeType() {
38 switch (PlatformInformation.getPlatform()) {
39 case MACOS:
40 return EExeType.OSBINARY;
41 default:
42 return EExeType.WINEXE;
43 }
44 }
45
46 /**
47 * @param windowed
48 * Run in windowed mode
49 * @throws FileNotFoundException
50 * If Oni's executable was not found
51 * @throws ERuntimeNotInstalledException
52 * If Linux and Wine not found
53 */
54 public static void launch(boolean windowed) throws FileNotFoundException,
55 ERuntimeNotInstalledException {
56 File exe = getOniExe();
57 Vector<String> params = new Vector<String>();
58 params.add("-debugfiles");
59 if (windowed)
60 params.add("-noswitch");
61 ApplicationInvoker.execute(getOniExeType(), Paths.getEditionBasePath(),
62 exe, params, true);
63 }
64
65 }