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

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

AEI2.00:

  • Fix launching Oni on MacOS
File size: 1.7 KB
RevLine 
[720]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
[767]18 private static File getOniExe() throws FileNotFoundException {
[720]19 File exe = null;
20 switch (PlatformInformation.getPlatform()) {
21 case WIN:
[767]22 case LINUX:
[720]23 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
[772]24 break;
[720]25 case MACOS:
[785]26 exe = new File(Paths.getEditionBasePath(),
27 "Oni.app/Contents/MacOS/Oni");
[772]28 break;
[720]29 default:
30 }
[772]31 if (exe.exists())
32 return exe;
33 else
[785]34 throw new FileNotFoundException("Oni's executable was not found");
[720]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 }
[766]45
[720]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");
[766]61 ApplicationInvoker.execute(getOniExeType(), Paths.getEditionBasePath(),
[767]62 exe, params, true);
[720]63 }
64
65}
Note: See TracBrowser for help on using the repository browser.