ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/backend/oni/OniLauncher.java
Revision: 766
Committed: Sun Mar 31 15:13:35 2013 UTC (12 years, 6 months ago) by alloc
Content type: text/x-java
File size: 1898 byte(s)
Log Message:
AEI2 0.99y:
- Restore files missing in WC

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() {
19 File exe = null;
20 switch (PlatformInformation.getPlatform()) {
21 case WIN:
22 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
23 break;
24 case MACOS:
25 exe = new File("./Oni.app/Contents/MacOS/Oni");
26 if (new File(Paths.getEditionBasePath(),
27 "Oni.app/Contents/MacOS/Oni").exists())
28 return exe;
29 break;
30 case LINUX:
31 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
32 break;
33 default:
34 }
35 if ((exe != null) && !exe.exists())
36 exe = null;
37 return exe;
38 }
39
40 private static EExeType getOniExeType() {
41 switch (PlatformInformation.getPlatform()) {
42 case MACOS:
43 return EExeType.OSBINARY;
44 default:
45 return EExeType.WINEXE;
46 }
47 }
48
49 /**
50 * @param windowed
51 * Run in windowed mode
52 * @throws FileNotFoundException
53 * If Oni's executable was not found
54 * @throws ERuntimeNotInstalledException
55 * If Linux and Wine not found
56 */
57 public static void launch(boolean windowed) throws FileNotFoundException,
58 ERuntimeNotInstalledException {
59 File exe = getOniExe();
60 if (exe == null)
61 throw new FileNotFoundException("Oni's executable was not found");
62 Vector<String> params = new Vector<String>();
63 params.add("-debugfiles");
64 if (windowed)
65 params.add("-noswitch");
66 ApplicationInvoker.execute(getOniExeType(), Paths.getEditionBasePath(),
67 exe, params);
68 }
69
70 }