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

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

AEI2 0.99y:

  • Restore files missing in WC
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() {
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}
Note: See TracBrowser for help on using the repository browser.