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

Last change on this file since 770 was 767, checked in by alloc, 12 years ago

AEI2 0.99y:

  • Perhaps fixes launching Oni on MacOS
File size: 1.9 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() 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 if (exe.exists())
25 return exe;
26 else
27 throw new FileNotFoundException(
28 "Oni's executable was not found");
29 case MACOS:
30 exe = new File("./Oni.app/Contents/MacOS/Oni");
31 if (new File(Paths.getEditionBasePath(),
32 "Oni.app/Contents/MacOS/Oni").exists())
33 return exe;
34 else
35 throw new FileNotFoundException(
36 "Oni's executable was not found");
37 default:
38 }
39 return null;
40 }
41
42 private static EExeType getOniExeType() {
43 switch (PlatformInformation.getPlatform()) {
44 case MACOS:
45 return EExeType.OSBINARY;
46 default:
47 return EExeType.WINEXE;
48 }
49 }
50
51 /**
52 * @param windowed
53 * Run in windowed mode
54 * @throws FileNotFoundException
55 * If Oni's executable was not found
56 * @throws ERuntimeNotInstalledException
57 * If Linux and Wine not found
58 */
59 public static void launch(boolean windowed) throws FileNotFoundException,
60 ERuntimeNotInstalledException {
61 File exe = getOniExe();
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, true);
68 }
69
70}
Note: See TracBrowser for help on using the repository browser.