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

Last change on this file since 816 was 785, checked in by alloc, 12 years ago

AEI2.00:

  • Fix launching Oni on MacOS
File size: 1.7 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 break;
25 case MACOS:
26 exe = new File(Paths.getEditionBasePath(),
27 "Oni.app/Contents/MacOS/Oni");
28 break;
29 default:
30 }
31 if (exe.exists())
32 return exe;
33 else
34 throw new FileNotFoundException("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}
Note: See TracBrowser for help on using the repository browser.