source: java/installer2/src/net/oni2/aeinstaller/backend/oni/OniLauncher.java@ 741

Last change on this file since 741 was 720, checked in by alloc, 12 years ago

AEI2: Looooots of refactorings for breaking out independent features into libraries

File size: 1.8 KB
Line 
1package net.oni2.aeinstaller.backend.oni;
2
3import java.io.File;
4import java.io.FileNotFoundException;
5import java.util.Vector;
6
7import net.oni2.aeinstaller.backend.Paths;
8import net.oni2.platformtools.PlatformInformation;
9import net.oni2.platformtools.applicationinvoker.ApplicationInvoker;
10import net.oni2.platformtools.applicationinvoker.EExeType;
11import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException;
12
13/**
14 * @author Christian Illy
15 */
16public 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(Paths.getEditionBasePath(),
26 "Oni.app/Contents/MacOS/Oni");
27 break;
28 case LINUX:
29 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
30 break;
31 default:
32 }
33 if ((exe != null) && !exe.exists())
34 exe = null;
35 return exe;
36 }
37
38 private static EExeType getOniExeType() {
39 switch (PlatformInformation.getPlatform()) {
40 case MACOS:
41 return EExeType.OSBINARY;
42 default:
43 return EExeType.WINEXE;
44 }
45 }
46
47 /**
48 * @param windowed
49 * Run in windowed mode
50 * @throws FileNotFoundException
51 * If Oni's executable was not found
52 * @throws ERuntimeNotInstalledException
53 * If Linux and Wine not found
54 */
55 public static void launch(boolean windowed) throws FileNotFoundException,
56 ERuntimeNotInstalledException {
57 File exe = getOniExe();
58 if (exe == null)
59 throw new FileNotFoundException("Oni's executable was not found");
60 Vector<String> params = new Vector<String>();
61 params.add("-debugfiles");
62 if (windowed)
63 params.add("-noswitch");
64 ApplicationInvoker.execute(getOniExeType(), exe.getParentFile(), exe,
65 params);
66 }
67
68}
Note: See TracBrowser for help on using the repository browser.